help with C program
tmh88
Pittsburgh / Athens, OH
Hey guys I need a little bit of help with a C program. Its a simple program that asks for the radius, and calculates the area of a cirlce. I have lab tomorrow for the class and my professor already told us the assignment so I just want to get it working so I can finish with the lab quickly. Anyway heres what I have. I'd appreciate it if someone would run this in a compiler for me to check and see if it works (i dont have one installed on this computer).
# include <stdio.h>
# define PI 3.14
int main (void) {
double radius, area;
printf ("Enter size of the radius");
scanf "%1f", & radius";
area = radius * radius * PI;
printf ("The area equals", area);
return(0);
}
I'm new to C so let me know if you see something obvious, or if it can be made simpler.
# include <stdio.h>
# define PI 3.14
int main (void) {
double radius, area;
printf ("Enter size of the radius");
scanf "%1f", & radius";
area = radius * radius * PI;
printf ("The area equals", area);
return(0);
}
I'm new to C so let me know if you see something obvious, or if it can be made simpler.
0
Comments
also, you can download cygwin (and make sure you get gcc) so you can have a c-compiler.
and, use [php] [/php] tags to post code.
I asked my professor and said that we will be using the gnu compiler.
edit:
and you're missing an open curly bracket after main()
The only thing I see wrong with your code is the scanf statement. It should use %lf, not %1f. I guess you looked at some example code and it was hard to distinguish between a lowercase L and a one?
heh, oops...