View Code of Problem 54

#include<stdio.h>
#include<math.h>
int main(){
	int x,i,count=0,temp;
	scanf("%d",&x);
	temp = x;
	while(temp!=0){
		count++;
		temp /= 10;
	}
	//printf("%d\n",count);
	while(count){
		temp = pow(10,count-1);
		//printf("%d\n",temp);
		printf("%d",x/temp);
		x = x%temp;
			
		if(count!=1)
			printf(" ");
		count--;
	}
	
	return 0 ;
}

Double click to view unformatted code.


Back to problem 54