You are on page 1of 2

// Input the radius of a circle, and output the area.

#include <iostream> #include <string> using namespace std; int main () { pounds, kg; cout << "what is your name (first name only)?"; cin >> name; cout << "how many pounds do you weigh? "; cin >> pounds; kg = pounds / 2.205; cout << name <<", you weigh" << kg << "kilograms." <<endl; }

// Input the radius of a circle, and output the area. #include <iostream> using namespace std; #include <string> int main () { double pi, radius, area, circumference, diameter; pi = 3.1415926535897; cout << "Please input the value of the diameter: "; cin >> diameter; radius = diameter/2.; area = pi * (radius*radius); circumference = 2 * pi * radius; cout << "The area of the circle is " << area << " and the circumference is " << circumference << '.' << endl; }

3.141592387

Hw 1d
#include <iostream> using namespace std; int main () { cout << "This program will determine the area, cirfumference and radius of a circle" <<endl; return 0; } const double PI = 3.14159; double radius; double circumference; cout << "Please enter the radius: "; cin >> radius; double diameter = // use the formula for calculating the diameter. sqrt circumference = // use the formula for calculating the circumference. double area = // use the formula for calculating the area. cout << "The diameter is " <<endl; cout << "The circumference is " <<endl; cout << "The area is " <<endl;

You might also like