Answer to Question #262260 in C++ for Nicki

Question #262260

Suppose m and r are integers. Write two different ways of C++ expression for mr2,store the result to variable result. The other expression uses the math function for r2 and the other doesn’t use the math



function but the equivalent expression

1
Expert's answer
2021-11-07T10:15:03-0500
#include <iostream>
#include <cmath>
using namespace std;


int main()
{
    int m=10,r=8,result;
    result=m*(r*r);
    result=m*pow(8,2);
    cout << "result: " << result<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS