Answer to Question #177029 in C++ for Joshua

Question #177029

calculate the perimeter and area of a rectangle; take length = 20 and width = 30 prove your answer using C++ program


1
Expert's answer
2021-03-30T18:30:53-0400
#include <iostream>
using namespace std;

int main() {
    int length = 20;
    int width = 30;
    int perimeter = 2 * (length + width);
    int area = length * width;

    cout << "The area of a rectangle is " << area << endl;
    cout << "The perimeter of a rectangle is " << perimeter << endl;
}

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