0

Reverse a Number in C

#include<stdio.h>
#include<conio.h>
void main()
{
int sum=0,a,b;
clrscr();
printf(“enter any four digit no.=”);
scanf(“%d”,&a);
b=a%10;
sum=sum*10+b;
a=a/10;
b=a%10;
sum=sum*10+b;
a=a/10;
b=a%10;
sum=sum*10+b;
a=a/10;
b=a%10;
sum=sum*10+b;
printf(“the sum of the digit of no is %d”,sum);

getch();
}

ks007

Leave a Reply

Your email address will not be published. Required fields are marked *