View Code of Problem 54

# include<stdio.h>
int main(){
	long int n;
	int x,a,A[100]={0},cnt=0;
	scanf("%ld",&n);
	x=n;
	while(x){
		a=x%10;
		A[cnt++]=a;
		x=x/10;	
	}
	for(int i=cnt-1;i>=0;i--){
		if(i==0){
			printf("%d",A[i]);	
		}
	    else{
			printf("%d ",A[i]);
		}	
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 54