C Program to find area of Square

Description

Get side of square and find area of square
Sample Input 1:
4
Sample Output 1:
16

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;

}

Explanation

Get side of a square (using scanf statement)

Calculate area by multiplying side and side(area = side * side)

print area(using printf statement)



Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution