C Programming Tips & Tricks





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Code Snippets
 List All
 Arrays
 Calculators
 Datatypes
 Date & Time
 File Manipulation
 Math Functions
 Multimedia
 Others
 




Calculate Circumference of Circle - C

Snippets  C  Calculate Circumference of Circle
Snippet On
Circle Circumference




Code
  
Rate this page :
  [ 0 votes]


#include <stdio.h>
#define PI 3.14159
int main(void)
{
float area , circumference , radius;
printf(<q>What is the radius of the circle.\n</q>);
scanf(<q>%f</q>,&radius);
area = PI * radius * radius;
circumference = 2.0 * PI * radius;
printf(<q>The circumference of the circle is %1.2f.\n</q>,circumference);
printf(<q>The area of the circle is %1.2f.\n</q>,area);
return 0;
}

Output:
What is the radius of the circle 4
The circumference of the circle is 25.12




Other Links

web hosting