APC-PRAC-003.c (569B)
1 /* 2 * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025 3 * Repo: https://github.com/notamitgamer/bsc 4 * License: MIT 5 */ 6 7 /* WAP to accept diagonal of a square and calculate area, parimeter */ 8 9 #include <stdio.h> 10 #include <math.h> 11 int main() 12 { 13 double dia, side, area, peri; 14 printf("Enter the diagonal of the square : "); 15 scanf("%lf", &dia); 16 side = dia / sqrt(2); 17 area = pow(side, 2); 18 peri = 4 * side; 19 printf("\nArea of the square : %g" 20 "\nPerimeter of the square : %g", 21 area, peri); 22 return 0; 23 }