View Code of Problem 54

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

Double click to view unformatted code.


Back to problem 54