小试牛刀
将一个三位数整数,正确分离出它的个位、十位和百位数字,并分别在屏幕上输出。
#include<math.h>
main()
{ int n,a,b,c;
scanf("%3d",&n);
a=n/100;
b=n%100/10;
c=n%100%10/1;
printf("a=%d,b=%d,c=%d\n",a,b,c);
}
main()
{ int n,a,b,c;
scanf("%3d",&n);
a=n/100;
b=n%100/10;
c=n%100%10/1;
printf("a=%d,b=%d,c=%d\n",a,b,c);
}