Using the methods
Findsum(int,int) //return total
FindProduct(int,int) //returns the product of the two integers
Write main method to find and print the answer of the expression,
32 + 83 +91
#include <iostream>
using namespace std;
int FindProduct(int a, int b){
int product = 1;
for(int i = 0; i < b; i++){
product *= a;
}
return product;
}
int Findsum(int a, int b){
return a + b;
}
int main(){
cout<<Findsum(Findsum(FindProduct(3, 2), FindProduct(8, 3)), FindProduct(9, 1));
return 0;
}
Comments
Leave a comment