A Program to Find the Area of a Square
In this example, we are giving a program to find the area of a square. The rule of finding the area of a square is: A = length * length.
Program to find the area of a square:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
float l, area;
printf("Enter the value of the length of a side: ");
scanf("%f",&l);
area = pow(l,2);
printf("Area of square: %.2f", area);
return 0;
}
Output:
Enter the value of the length of a side: 3 Area of square: 9.00