The area of a rectangle is its length times its height Write

The area of a rectangle is its length times its height. Write a C program that inputs two floating point numbers from the keyboard that represent the length and the height of a rectangle. Your program should output the area of the rectangle. If you use the type double to declare your variables, you will need to use the % If format code with scanf. See the back cover pages of your book. If you use the type float to declare your variables, you will need to use the % f format code with scanf. The function printf, on the other hand, use % f for both double and float types. These little tidbits are in your textbook.

Solution

#include<stdio.h>

#include<conio.h>

int main()

{

float length, height, area;

printf(\"Enter length of Rectangle\ \");

scanf(\"%f\", &length);

printf(\"Enter height of Rectangle\ \");

scanf(\"%f\", &height);

area = length * height;

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

getch();

return 0;

}

 The area of a rectangle is its length times its height. Write a C program that inputs two floating point numbers from the keyboard that represent the length an

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site