View Code of Problem 54

#include<stdio.h>
int main(){
	long n;
	int i=0;
	int inter[20];
	scanf("%d",&n);
	long m=n;
	while(m/10!=0){
		inter[i]=m%10;
		m=m/10;
		i++;
	}
	inter[i]=m%10;
	for(int j=i;j>=0;j--){
		if(j!=0){
			printf("%d ",inter[j]);
		}
		else{
			printf("%d",inter[j]);
		} 
	}
}

Double click to view unformatted code.


Back to problem 54