Ask Question
10 September, 19:52

A basic program to find the area of a square

+5
Answers (1)
  1. 10 September, 20:21
    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?
Find an answer to your question ✅ “A basic program to find the area of a square ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers