Closed roberthsu2003 closed 3 weeks ago
#include <iostream>
#include <math.h>
using namespace std;
int fun1(int x, int y){
return pow(x, 3) + 3 * pow(x, 2) * y + 3 * x * pow(y, 2) + pow(y, 3);
}
int main() {
for(int x = 1; x < 5; x++){
for(int y = 1; y < 5; y++){
printf("f(%d, %d) = %d\n", x, y, fun1(x, y));
}
}
}
#include <iostream>
#include <math.h>
using namespace std;
int fun(int x, int y){
int f = pow(x, 3) + 3 * pow(x, 2) * y + 3 * x * pow(y, 2) + pow(y, 3);
return f;
}
int main() {
for(int x = 1; x <= 4; x++){
for(int y = 1; y <= 4; y++){
printf("f(%d, %d) = %d\n", x, y, fun(x, y));
}
}
}