// Program to reverse a number and sum of reversed number
#include
#include
#include
void main()
{
int i,n,rev,sum=0;
clrscr();
printf("Enter a number");
scanf("%d",&n);
do
{
rev=n%10;
printf("%d",rev);
n=n/10;
sum=sum+rev;
}
while(n!=0);
printf("\nSum is %d", sum);
getch();
}
Algorithm
· Start
· Declare i, n, rev, sum=0 as integer
· Write("the number")
· Read(“the number”)
· Do start
· rev=n%10
· Read("the reverse number”)
· n=n/10
· sum=sum+rev
· Do end
· Read("the sum”)
· Stop
0 comments:
Post a Comment