-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAREACIR.C
30 lines (24 loc) · 957 Bytes
/
AREACIR.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Jason J. Davis
COMP-335L
AAHS Summer '97
Sign off:____________________________ Row #:7
Date: ________________ Due:
AreaCir.c -- This program will calculate the area of a circle .
It is written in (mostly) ANSI C and demonstrates the
three primary parts of a program - input,process,and output.
*/
#include <stdio.h> /* necessary for printf() and scanf */
#include <conio.h> /* necessary for clrscr () and getch() note:conio.h is NOT part of ANSI C*/
void main (void)
{
double radius, area;
const double PI =3.14159265358979;
clrscr();
printf("\n\nPlease enter the radius of your circle => ");
scanf("%lf", & radius);
area = PI * radius*radius; /* area = PIr2 */
clrscr();
printf("\n\n\n\nWith a radius of %f units, ", radius);
printf("your circle has an area of %f units2", area);
getch (); /* wait for user keystroke (when finished reading*/
}