View Code of Problem 54

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

Double click to view unformatted code.


Back to problem 54