bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / tuition-c / APC-PRAC-003.c

APC-PRAC-003.c (433B)


      1 /* WAP to accept  diagonal of a square and calculate area, parimeter */
      2 
      3 #include <stdio.h>
      4 #include <math.h>
      5 int main()
      6 {
      7     double dia, side, area, peri;
      8     printf("Enter the diagonal of the square : ");
      9     scanf("%lf", &dia);
     10     side = dia / sqrt(2);
     11     area = pow(side, 2);
     12     peri = 4 * side;
     13     printf("\nArea of the square      : %g"
     14            "\nPerimeter of the square : %g",
     15            area, peri);
     16     return 0;
     17 }