To Find Parameters of Circle

  1. /* Header Files */  
  2.   
  3. #include<iostream.h>  
  4.   
  5. #include<conio.h>  
  6.   
  7. /* Main Function */  
  8.   
  9. void main ()  
  10.   
  11. {  
  12.   
  13. /* Clearing Previous Result */  
  14.   
  15. clrscr();  
  16.   
  17. /* Declaring Variable of Float and Int type */  
  18.   
  19. int r, d;  
  20.   
  21. float a ,c;  
  22.   
  23. def fun pi = 3.14;  
  24.   
  25. /* Assigning the Value of r */  
  26.   
  27. cout <<"Enter the value of r <<"\n";  
  28.   
  29. /* Storing the Value */  
  30.   
  31. cin >> r;  
  32.   
  33. /* Calculating various Parameters */  
  34.   
  35.   
  36. /* Diameter of Circle */  
  37.   
  38. d = (2*r);  
  39.   
  40.   
  41. /* Area of Circle */  
  42.   
  43. a = (pi*r*r);  
  44.   
  45. /* Circumference of Circle */  
  46.   
  47. c = (2*pi*r);  
  48.   
  49. /* Displaying the Output Values */  
  50.   
  51. cout << "Diameter of Circle is: " << d;  
  52.   
  53. cout << "Area of Circle is: " << a;  
  54.   
  55. cout << "Circumference of Circle is: " << c;  
  56.   
  57. /* Get the output screen at the Execution */  
  58.   
  59. getch();  
  60.   
  61. }  

Output

Enter the value of r

2

Diameter of Circle is: 4

Area of Circle is: 12.56

Circumference of Circle is: 12.56