Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- It prints separately and in a forward fashion all digits of a given non-negative integer number.
- */
- #include <stdio.h>
- int main(){
- int x;
- int y;
- int k = 10;
- printf("Enter x: ");
- scanf("%d", &x);
- while((x/k) >= 1){
- k = k * 10;
- };
- while(k > 1){
- k = k/10;
- y = x/k;
- printf("%d\n", y);
- x = x - y * k;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement