Separating Integers
Write a program that inputs one five-digits number,
separates the number into its individual digits and prints the digits from one
another by three spaces each.
solution
#include<stdio.h>
int
main(void)
{
/*Starting numbers */
int n;
int one,two, thr,fov,fiv;
printf("Enter a five digits:");
scanf("%d", &n);
one=n/10000;
two=(n%10000)/1000;
thr=((n%10000)%1000)/100;
fov=(((n%10000)%1000)%100)/10;
fiv=((((n%10000)%1000)%100)%10)/1;
printf("%d %d
%d %d %d\n", one, two, thr, fov, fiv);
return 0;
}
Comments
Post a Comment
Please feel free to comments if you have any ideas, questions and subjection concerning our post and programs