Computer Science, asked by shreyas2587, 5 months ago

write c++ program to compute area of square​

Answers

Answered by bipnadevi1984
1

Answer:

tsdgrskdysjrtsgkkyddkdylrwtisktsdktsjg

Answered by SanchitaChanglani01
0

Answer:

The formula to calculate the area of a square is:

Area = length * length

Example: C++ program to calculate the area of square

/* program to calculate the area of square */

#include <iostream>

using namespace std;

int main() //function main begins program execution

{

int square_area, square_side;

cout << "Enter the side of square:";

cin >> square_side;

square_area = square_side * square_side;

cout << "Area of Square: " << square_area << endl;

return 0;

} // end main

Output

c++ program to find the area of square - output

Example: C++ program to calculate the area of square using function

/* program to calculate the area of square using function */

#include <iostream>

using namespace std;

void area(); //function prototype

int main() //function main begins program execution

{

area(); //function call

return 0;

} // end main

void area() //called function

{

int square_area, square_side;

cout << "Enter the side of square:";

cin >> square_side;

square_area = square_side * square_side;

cout << "Area of Square: " << square_area << endl;

} //end function area

Output

C++ program to calculate the area of square using function

Similar questions