View Code of Problem 54

#include<stdio.h>
#include <string.h>
int main(){
	int x;
    int t;
    int mask=1;
    scanf("%d",&x);
    t=x;
    while(t>9)
    {
        t /= 10;
        mask *=10;
    }
    do
    {
        int d = x/mask;
        printf("%d",d);
        if(mask>9)
        {
            printf(" ");
        }
        x %=mask;
        mask /=10;
    }while(mask>0);


	printf("\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 54