I need help with something, I'm new to programming, currently doing an assignment that calculates the Area and perimeter of a Rectangle. I don't know what I'm doing wrong.
#include <stdio.h>
int main()
{
float Area; //used to calculate the Area of a rectangle
float Perimeter; //used to calculate the Perimeter of a rectangle
float length; //length of rectangle
float width; //width of rectangle
length = 3.5; //length of rectangle
width = 5.48; //width of rectangle
Area = length*width;
Perimeter = 2(length+width);
printf("\nArea of rectangle: %fArea Square units");
printf("\nPerimeter of rectangle: %fPerimeter units");
return 0;
}
I have to have it in this format or hypergrade will fail me
Program Output
Area of rectangle: 19.180000 square units
Perimeter of rectangle: 17.959999 units
{
float Area; //used to calculate the Area of a rectangle
float Perimeter; //used to calculate the Perimeter of a rectangle
float length; //length of rectangle
float width; //width of rectangle
length = 3.5; //length of rectangle
width = 5.48; //width of rectangle
Area = length*width;
Perimeter = 2(length+width);
printf("\nArea of rectangle: %fArea Square units", Area);
printf("\nPerimeter of rectangle: %fPerimeter units", Perimeter);
return 0;
}
Now I'm having problems with the Perimeter formula.
"19 28 [Error] expression cannot be used as a function"