Monday, June 24, 2013

Write a program to print the sum of the two no in reverse order ?

Problem 
    Find the sum of two no and print their result in reverse order .ex 12+12=24 should be printed as 42
solution

#include<stdio.h>
#include<conio.h>

void main()
{
int a,b,sum,rsum=0,n;
clrscr();
printf("enter the no1 and no2");
scanf("%d%d",&a,&b);
sum=a+b;
while(sum!=0)
{
n=sum%10;
rsum=rsum*10+n;
sum=sum/10;
}

printf("the near perfect square is %d ",rsum);
getch();
}

Output


Like the Post? Do share with your Friends.

No comments:

Post a Comment