In C Write down the output include using namespace std int c

In C++, Write down the output

#include <iostream>

using namespace std;

int calArea(int, int);

int main(){

     int height=10;

     int width = height*3;

     int area = calArea(height,width);

     cout << height << \" \" << width << \" \" << area << endl;

     return 0;

}

int calArea(int h, int w) {

     int a = h * w;

     h--;

     w--;

     return a;

}

Solution

// initially we declared calArea() method with two integers as a parameters

// in the main function we assigned height with integer value and width with integer value

// in the method the area is calculated and it is called in the main method and cout statement is used for printing output.

when we compile the above c++ program the output is

10 30 300

In C++, Write down the output #include <iostream> using namespace std; int calArea(int, int); int main(){ int height=10; int width = height*3; int area =

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site