C++ program to compute the area of a square.

Q14. Write a C++ program to compute the area of a square. Make assumption on your own.

Ans.

#include<iostream.h>

#include<conio.h>  //for clrscr();

void main()

{

float side,area;

clrscr();   //for clear screen

cout<<“\n Enter side of the square: “;

cin>>side;

area=side*side;

cout<<“\n The area of the square is: “<<area<<” square units”;

}

 

Output

Enter side of the square: 5

The area of the square is: 25 square units

Leave a Reply

Your email address will not be published. Required fields are marked *

104 Views
%d bloggers like this: