User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Begin1. Given the side of the square \(a\). Find its perimeter \(P = 4 \cdot a \).

Solution in Python 3:

a = int(input("Enter the side of the square (a): "))
P = 4*a
print("Perimeter P: ", P)

Solution in C++:

#include <iostream>
using namespace std;
int main(){
double a, p;
cout << "Enter the side of the square (a): ";
cin >> a;
p = 4*a;
cout << "Perimeter: " << p;
return 0;
}