C++ float type Computes a circle with radius of 5 and 20

Description

C++ float type Computes a circle with radius of 5 and 20

#include <iostream>
using namespace std;
int main()//from  ww  w. ja  va2 s .  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;
}



PreviousNext

Related