calculate the perimeter and area of a rectangle; take length = 20 and width = 30 prove your answer using C++ program
#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;
}
Comments
Leave a comment