# C program to calculate the area of square with and without using function

In this program, we will learn about C program to calculate the area of square using function and without using the function. # C program to calculate the area of square

For better understanding of the program, you should know about following C programming topic :

The formula to calculate the area of a square is:

`Area = length * length`

## Area of square without using function

``````#include <stdio.h>

int main()
{
int square_side, area;

printf("Enter the side of square: ");
scanf("%d", &square_side);
//calculation of the area
area = square_side * square_side;

printf("Area of the square: %d", area);
return 0;
}
``````

Output: ## Area of square using function

``````/* program to calculate the area of square */
#include <stdio.h>
void area(); //function prototype

int main() //function main begins program execution
{
area(); //function call
return 0;
}
// end main
void area() //called function
{
int square_area, square_side;

printf("Enter the side of square:");
scanf("%d",&square_side);
square_area = square_side * square_side;
printf("Area of Square = %d",square_area);
} //end function area
``````

Output: 