Decode School

Decode School - The School for Problem Solvers

Welcome to my blog. Subscribe and get my latest blog post in your inbox.

C Program to find area of Square

Get side of square and find area of square

Sample Input 1:

4

Sample Output 1:

16

Program or Solution

					    
							
#include<stdio.h>

int main()

{
    
	int side,area;
	printf("Enter a side of square:");
    
	scanf("%d",&side);

	area=side * side;
    
	printf("\nArea of Square: %d",area);
    
	return 0;

}
					    
					

Program Explanation

Get side of a square (using scanf statement)

Calculate area by multiplying side and side(area = side * side) print area(using printf statement)