Header Ads

Header ADS

Radius | area | circle calculator

Radius | area | circle calculator


Write a C++ program that stores the number 105.62 in the variable firstnum, 89.352 in the variable secnum, and 98.67 in the variable thirdnum. Have your program calculate the total of the three numbers and their average. The total should be stored in the variable total and the average in the variable average. Use the cout object to display the total and the average.


 Algorithm

STEP#1    Start
STEP#2    Declare the variable Firstnum, Secnum, Thirdnum, Total,  Average
STEP#3    Assign value 105.62 to Firstnum
STEP#4    Assign value 89.352 to Secnum
STEP#5    Assign value 98.67 to Thirdnum
STEP#6    Calculate Total and Average
STEP#7    Total= (Firstnum+Secnum+Thirdnum)
STEP#8    Average= (Total/3)
STEP#9    Display the Total
STEP#10    Display the Average
STEP#11    End





#include <iostream>
using namespace std;
int main()
{
    float radius,area,circum;
    radius=3.5;
    area=3.14*(radius*radius);
    circum=2*3.14*(radius);
    cout<<area<<"\n";
    cout<<circum<<"\n";
    return 0;
}







radius,area,circum

No comments

Powered by Blogger.