Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

program is working but output is not correct

the program isworking alright but the area or output is not coreect

i tried everything but it is not working properly

#include<stdio.h>
#include<conio.h>
int square(int a);
float circle(float  b);
int  rectangle(int c, int d);
int main()
{
int a,b,c,d;
printf("enter side of square");
scanf("%d ",&a);
printf("enter radius of circle ");
scanf("%d ",&b);
printf("enter sides of recatngle ");
scanf("%d ",& c);         
scanf("%d",& d) ;

printf("%d \n\t",square);
printf("%d \n\t",circle);
printf("%d \n\t",rectangle);
    getch();
    return 0;
    
}
// functions //

int square (int a){
    return a*a;
}
float circle(float b){
    return 3.14*b*b;
}
int rectangle(int c, int d){
    return c*d;
}

the output which is coming while running this program for area of rectangle circle and square is not correct

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

printf("%d \n\t",square);
printf("%d \n\t",circle);
printf("%d \n\t",rectangle);

Is incorrect. To call the functions you need to use () and pass the parameters. You also need to use the correct printf formats to display parameters of different types.

printf("%d \n\t",square(a));
printf("%f \n\t",circle(b));
printf("%d \n\t",rectangle(c,d));

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading