0:15 AM 2007-2008 question 4 |
write a program to read the value of two integers and calculate the sum of squares of these numbers the program should use three function
1- sum of two num
2- square of value
3- sum of squares of two num
#include"stdio.h"
int sum(int a, int b);
int sq(int c);
int sumsq(int d, int e);
main()
{
int x, y;
printf("enter two numbers : ");
scanf("%d%d", &x, &y);
printf("the sum of squares of the two numbers is %d", sumsq(x,y));
getch();
return 0;
}
int sum(int a, int b){
int sum=a+b;
return sum;
}
int sq(int c){
int square=c*c;
return square;
}
int sumsq(int d, int e){
int sumofsq=sum(sq(d),sq(e));
return sumofsq;
}
|
|
Total comments: 0 | |