View Code of Problem 54

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

Double click to view unformatted code.


Back to problem 54