Ask Question
19 October, 11:34

A basic program to find the area of a square

+4
Answers (1)
  1. 19 October, 13:33
    0
    The area of a square is simply the square of the side. So, you only need to write a program that receives a number as input, which is the side of the square, and returns that number squared, which will be the area of the square.

    You didn't specify any language, so for example here's a C implementation that receives the side from the user and returns the area:

    #include

    int main ()

    {

    double side, area;

    do{

    printf ("Enter the side of the square (must be >0) : ");

    scanf ("%lf", &side);

    } while (side<=0);

    area = side * side;

    printf ("The area is %lf", area);

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A basic program to find the area of a square ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers