Question #35049

write a program that will accept the lenght of the side of square and print out its perimeter and area.

Expert's answer

#include <iostream>

using namespace std;

int main(){

float a, b;

//enter side

cout << "Enter the length of side (a, b) ";

cin >> a >> b;

//compute perimeter

cout << "Perimeter is " << (a + b) * 2 << "

";

//compute area

cout << "Area is " << a * b << "

";

return 0;

}

using namespace std;

int main(){

float a, b;

//enter side

cout << "Enter the length of side (a, b) ";

cin >> a >> b;

//compute perimeter

cout << "Perimeter is " << (a + b) * 2 << "

";

//compute area

cout << "Area is " << a * b << "

";

return 0;

}

## Comments

## Leave a comment