Write a program containing a function that takes 2 integer parameters x and y and returns the value of x2 + y2. The main program should then allow the input of two integer values a and b and display the value of a2+b2.
Can someone help me?am having this error:
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
Whats wrong in this program?
I write n compile my program using linux terminal.
#include <stdio.h>
int submain(int a,int b)
{
return (a*a)+(b*b);
}
int main
{
int x,y,ans;
printf("Enter value of x: ");
scanf("%d", &x);
printf("Enter value of y: ");
scanf("%d", &y);
ans=submain(x,y);
printf("(x*x)+(y*y) %d",ans);
return 0;
}