#include<stdio.h>
#include<math.h>
int f(int, int, int); /* function prototype for f(x) */
int main()
{
int a,b;
int x,y;
double g; /* g=g(x,y) */
printf("a, b: ");
scanf("%d%d",&a, &b);
printf("x,y: ");
scanf("%d%d",&x, &y);
g=(f(x,a,b))+(pow((f(y,a,b)),3)); /* make sure that return value of pow()
function is assigned to double */
printf("g(%d,%d)=%g",x,y,g);
return 0;
}
int f(int x, int a, int b)
{
return(a*x+b);
}
#include<math.h>
int f(int, int, int); /* function prototype for f(x) */
int main()
{
int a,b;
int x,y;
double g; /* g=g(x,y) */
printf("a, b: ");
scanf("%d%d",&a, &b);
printf("x,y: ");
scanf("%d%d",&x, &y);
g=(f(x,a,b))+(pow((f(y,a,b)),3)); /* make sure that return value of pow()
function is assigned to double */
printf("g(%d,%d)=%g",x,y,g);
return 0;
}
int f(int x, int a, int b)
{
return(a*x+b);
}
Sample input:
a, b: 5 6
x, y: 2 6
x, y: 2 6
No comments:
Post a Comment