apc-prac-003.c¶
Problem Statement
WAP to accept diagonal of a square and calculate area, parimeter
Metadata¶
| Property | Detail |
|---|---|
| Author | Amit Dutta (amitdutta4255@gmail.com) |
| License | MIT |
Actions¶
💡 You can print or save this file by opening Raw and using your browser.
Source Code¶
#include <stdio.h>
#include <math.h>
int main()
{
double dia, side, area, peri;
printf("Enter the diagonal of the square : ");
scanf("%lf", &dia);
side = dia / sqrt(2);
area = pow(side, 2);
peri = 4 * side;
printf("\nArea of the square : %g"
"\nPerimeter of the square : %g",
area, peri);
return 0;
}