View Code of Problem 54

#include<stdio.h>
#include<math.h>
main()
{
	int i,j,n,m,k,x;
	k=1;
	j=1;
	scanf("%d",&n);
	m=n;
	while(m/10!=0){
		k++;
		j=j*10;
		m=m/10;
	}
	if(k>1){	
	for(i=0;i<k-1;i++){
		x=n/j;
		x=x%10;
		j=j/10;
		printf("%d ",x);
	}
	}
    printf("%d",n%10);
}

Double click to view unformatted code.


Back to problem 54