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 / P014.c

P014.c (397B)


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