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
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
No comments:
Post a Comment