Ask Question

A basic program to find the area of a square

+1
Answers (1)
  1. 9 February, 03:19
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers