C program to compute the area of a square.

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

Ans.

#include<stdio.h>

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

void main()

{

float side,area;

clrscr();   //for clear screen

printf(“\n Enter side of the square: “);

scanf(“%f”,&side);

area=side*side;

printf(“\n The area of the square is: %f square units”,area);

}

 

Output

 

Enter side of the square: 5

The area of the square is: 25.000000 square units

Leave a Reply

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

123 Views
%d bloggers like this: