1.

draw a flowchart to input lenght and breadht of a rectangle from the user and display the perimeter of thr rectangle [area of a rectangle=2*(lenght +breath) ]​

Answer»

Answer:

include

#include

int MAIN()

{

float L, b, r,ca, cc, ra, rp;

//For rectangle

printf("ENTER the length of rectangle: ");

scanf("%f", &l);

printf("Enter the breadth of rectangle: ");

scanf("%f", &b);

//For circle

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

scanf("%f", &r);

//Calculate area & perimeter of the rectangle...

ra = l * b; //Area of Rectangle = Length x Breadth

rp = 2 * (l + b); //Perimeter of Rectangle = 2 x (Length + Breadth) or addition of all sides

//Calculate are & circumference of the circle...

ca = 3.14 * r * r; //Area of Circle = 2 x PI x r^2 where Pi = 3.14

cc = 2 * 3.14 * r; //Circumference of Circle = 2 x Pi x r

printf("\nThe area of the rectangle: %0.2f", ra);

printf("\nThe perimeter of the rectangle: %.2f", rp);

printf("\n\nThe area of the circle: %.2f", ca);

printf("\nThe circumference of the circle: %.2f", cc);

return (0);

}

Output:

Enter the length of rectangle: 3

Enter the breadth of rectangle: 2

Enter the radius of circle: 2

The area of the rectangle: 6.00

The perimeter of the rectangle: 10.00

The area of the circle: 12.56

The circumference of the circle: 12.56



Discussion

No Comment Found