Write an interactive program that contains an if statement t

Write an interactive program that contains an if statement that may be used to compute the area of a square ( area= side2 ) or a circle ( area= p* radius2 ) after prompting the user to type the first character of the figure name ( S or C).

Solution

void circle ()

{

int rad;

   float PI = 3.14, area, ci;

   printf(\"\ Enter radius of circle: \");

   scanf(\"%d\", &rad);

   area = PI * rad * rad;

   printf(\"\ Area of circle : %f \", area);

}

void square()

{

int side, area;

   printf(\"\ Enter the Length of Side : \");

   scanf(\"%d\", &side);

   area = side * side;

   printf(\"\ Area of Square : %d\", area);

}

Write an interactive program that contains an if statement that may be used to compute the area of a square ( area= side2 ) or a circle ( area= p* radius2 ) aft

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site