#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();
}
#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