View Code of Problem 54

#include<stdio.h>
void main()
{
    long int num;
    int i=0, j=0, a[10];
    scanf("%ld", &num);
    for(i=0; i<10; i++)
    {
        a[i] = num%10;
        num = num/10;
        if(num == 0)
            break;
    }

    for(j=i; j>=0; j--)
    {
        printf("%d", a[j]);
        if(j>0)
            printf(" ");
    }

}

Double click to view unformatted code.


Back to problem 54