Task: write a function to calculate the area of a square, rectangle, circle. My code is right. IDK why I am getting this error complete error
#include<stdio.h>
#include<math.h>
int square();
float airclearea();
int rectangle();
int main(){
int s,r1,r2;
float a;
printf("Enter the side of square : ");
scanf("%d",&s);
printf("Enter the side of rectangle");
scanf("%d %d",&r1,&r2);
printf("Enter the radius of circle");
scanf("%f",&a);
printf("%d",square(s));
printf("%d",rectangle(r1,r2));
printf("%f",airclearea(a));
return 0;
}
int square(int s){
return s*s;
}
int rectangle(int r1, int r2){
return r1*r2;
}
float airclearea(float a){
return 3.14*a*a;
}
You originally defined
float airclearea();near the top of your code as having no parameters. At the bottom of your code, you redefined it asThe first definition defines
float airclearea();, without parameters. Replace it withfloat airclearea(float a);. Your parameter isfloat a. You haven't shown your other error messages, but I would assume you are getting the same error withint rectangle();andint square();. Add parameters to the first definitions of both those functions, or just move themainfunction down to the bottom of your code and remove the top three placeholder definitions.