www.ypnh.net > 编写一个程序,其功能是输入一个三位数,计算并输...

编写一个程序,其功能是输入一个三位数,计算并输...

#include "stdio.h" void main() { int n,sum=0; printf("请输入一个三位数:"); scanf("%d",&n); sum=n/100+n%100/10+n%10;//百位数+十位数+个位数 printf("这个三位数各位数字之和是%d\n",sum); }

#include "stdio.h" void main() { int n,sum=0; printf("请输入一个三位数:"); scanf("%d",&n); sum=n/100+n%100/10+n%10;//百位数+十位数+个位数 printf("这个三位数各位数字之和是%d\n",sum); }

#include void main() { char num[100],i; int k=0; //计算数组位数 printf("请输入数组\n"); for(i=0;i=0;i--) { printf("%c ",num[i]); } }

vb代码如下:Private Sub Command1_Click() Dim m As Long, s As Long m = InputBox("请输入一个三位数整数") If Not IsNumeric(m) Then MsgBox "你输入的不是数字": Exit Sub If m < 100 Or m > 1000 Then MsgBox "你输入的不是三位整数": Exit...

代码如下,注释也在里面: #include #include int main() { int num,a,b,c; //输入三位数 printf("请输入一个三位整数:\n"); scanf("%d",&num); //输出各位数 a=num/100; b=(num-a*100)/10; c=(num-a*100-b*10); printf("千位-%d,十位-%d,个位-%...

int v;printf("Please input a value:\n");do{ scanf("%d",&v); if(v>=100&&v

#include int main(){int n, i, d[5];scanf("%d", &n);d[0] = n / 10000 % 10;d[1] = n / 1000 % 10;d[2] = n / 100 % 10;d[3] = n / 10 % 10;d[4] = n / 1 % 10;printf("%d", d[0]);for (i = 1; i < 5; i++)printf("***%d", d[i]);;return 0;}...

#include int main() { int n,N; printf("请输入您需要处理的三位整数:\n"); scanf("%d",&n); N=n%10*100+n%100/10*10+n/100; printf("\n处理后的整数为:%d\n",N); } 用C语言编的,希望能帮到你!

#include "stdio.h" void main() { int n,sum=0; printf("请输入一个三位数:"); scanf("%d",&n); sum=n/100+n%100/10+n%10;//百位数+十位数+个位数 printf("这个三位数各位数字之和是%d\n",sum); } 结果:

Private Sub Command1_Click() Do x = CInt(InputBox("请输入一个3位整数:")) Loop While x < 0 Or x > 999 a = x \ 100 b = x \ 10 Mod 10 c = x Mod 10 MsgBox (a & "+" & b & "+" & c & "=" & a + b + c) End Sub

网站地图

All rights reserved Powered by www.ypnh.net

copyright ©right 2010-2021。
www.ypnh.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com