Computes a circle with radius of 5 and 20. - C++ Data Type

C++ examples for Data Type:int

Description

Computes a circle with radius of 5 and 20.

Demo Code

#include <iostream>
using namespace std;
int main()/*from  w  ww  .jav  a  2s.c o  m*/
{
   const float PI = 3.14159;
   float radius = 5;
   float area;
   area = radius * radius * PI;  // Circle area calculation
   cout << "The area is " << area << " with a radius of 5.\n";
   radius = 20;     // Compute area with new radius.
   area = radius * radius * PI;
   cout << "The area is " << area << " with a radius of 20.\n";
   return 0;
}

Result


Related Tutorials