Skip to content

p014.c

Problem Statement

WAP to accept the diagonal of square. Find and display the area and perimeter of the square.

Metadata

Property Detail
Author Amit Dutta (amitdutta4255@gmail.com)
License MIT

Actions

Raw View on GitHub

💡 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 d, side, area, per;
    printf("Enter the diagonal : ");
    scanf("%lf", &d);
    side =  d / sqrt (2);
    area = side * side;
    per = 4 * side;
    printf("\nArea of the Square      : %lf"
           "\nPerimeter of the Square : %lf", area, per);
    return 0;
}