-
Notifications
You must be signed in to change notification settings - Fork 0
/
Chapter2-Q20.c
21 lines (20 loc) · 952 Bytes
/
Chapter2-Q20.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* (Diameter, Circumference and Area of a Circle) Write a program that reads in the radius
of a circle and prints the circle’s diameter, circumference and area. Use the constant value 3.14159
for ð. Perform each of these calculations inside the printf statement(s) and use the conversion specifier
%f. [Note: In this chapter, we have discussed only integer constants and variables. In Chapter 3
we’ll discuss floating-point numbers, i.e., values that can have decimal points.]
*/
#include <stdio.h>
///Bir hata var anlamadým..
int main ()
//Beginning of the main function
{
int radius, diameter;
float circum, area , pi;
pi = 3.14159 ;
printf( "Enter the value of radius: \n" );
scanf( "%d", &radius ); // read to radius
printf( "Diameter is: %d \n",diameter = radius * 2 );
printf( "Circumferance is :%d \n",circum = diameter * pi );
printf ( "Area of the circle is: %d \n", /*area = */pi * radius * radius );
}