Code Competitions

Coding competition

Monday, 13 May 2013

Program to find reverse of a number

#include<stdio.h>
#include<conio.h>
void main()
{
    unsigned int a,b,sum=0;
    clrscr();
    printf("enter the number");
    scanf("%d",&a);
    while(a>0)
    {
        b=a%10;
        a=a/10;
        sum=10*sum+b;
    }
    printf("the sum of digits =%d",sum);
    getch();
}

No comments:

Post a Comment