C Program to find area of Square

Get side of square and find area of square

Sample Input 1:

4

Sample Output 1:

16

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#include<stdio.h> int main() { //write your code here }

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)

Comments