SWAPPING OF TWO NUMBERS

October 07, 2018



SWAPPING OF TWO NUMBERS:
#include<studio.h>
#include<condo.h>
int main()
{
int a, b;
clrscr();
printf("ENTER TWO NUMBERS: \n");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("a=%d\n b=%d\n", a, b);
getch();
}
__________________________________________________________
Output:
ENTER TWO NUMBERS:13
                                            45
a=45
b=13



SWAPPING OF TWO NUMBERS SWAPPING OF TWO NUMBERS Reviewed by Amit Waghmare on October 07, 2018 Rating: 5

SUM OF THE SQUARE OF THE DIGIT OF THE NUMBER

October 07, 2018

SUM OF THE SQUARE OF THE DIGIT OF THE NUMBER:
#include<studio.h>
#include<conio.h>
int main()
{
int no, temp, sum=0;
clrscr ();
prints("ENTER THE NUMBER: \n");
scanf("%d",&no);
while(no/10!=0)
{
temp=no%10;
sum=sum+temp*temp;
no=no/10;
}
sum=sum+no*no;
printf("sum=%d", sum);
getch();
return 0;
}
___________________________________________________________________
Output:
ENTER THE NUMBER:786
sum=149



SUM OF THE SQUARE OF THE DIGIT OF THE NUMBER SUM OF THE SQUARE OF THE DIGIT OF THE NUMBER Reviewed by Amit Waghmare on October 07, 2018 Rating: 5