0
What's problem of this code
#include <stdio.h> #define PI=3.1416 int main(){ int r; float area; printf("Enter the r:"); scanf("%d",&r); area=PI*r*r); printf("\nThe area of circle is=%2f",&area); }
2 Antworten
+ 8
Tanjim Ahmed there is some syntax error.
#include <stdio.h>
#define PI 3.14
int main() {
float area;
float r;
printf ("Enter the radius-");
scanf("%f",&r);
area =PI*r*r;
printf ("Area is %2f\n",area);
return 0;
}
0
There are some mistakes in this code..
1. Syntax of defining constant is wrong...It should be like "#define PI 3.14" .
2. Idk if this is by mistake or what but there is a closing bracket at the end formula..Remove it.
3. You should not use "&" operator in printf statement for printing a value..If you use "&" operator then it will print address of variable.. In your case printf will give address of area variable..
4. Idk but may be it will give compile error bcoz you have not written return statement at the end of code.. So write "return 0;" before closing bracket of main function..