write a c++ problem to find the area of a square
Answers
/* 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
Required Program :
To find Area of Square :
#include <iostream>
using namespace std ;
int main ( )
{
float side , area ;
cout<< "Enter the Side of Square : ";
cin>>side ;
area = side * side ;
cout<<"Area = " <<area<<ends ;
return 0 ;
}
Output :
Enter the side of square : 8
Area = 64
Structure of C++ Program :
// Comment line
#include <iostream>
using namespace std ;
int main ( )
{
........
Body of Program ;
............
return 0 ;
}