Tuesday, February 7, 2017

How to Calculate age average with c++

#include<iostream>
#include<stdio.h>
using namespace std;
int main()

{
int age1,age2,age3,age4,avg;
int totalage,avgage;
cout<<"please enter your age1?";
cin>> age1;
cout<<"please enter your age2?";
cin>>age2;
cout<<"please enter your age3?";
cin>>age3;
cout<<"please enter your age4?";
cin>>age4;
totalage=age1+age2+age3+age4;
cout<<"total age of class is="<"totalage";
avgage=totalage/4;
cout<<"avg age of class="<<avgage;
"endl";
}

0 comments:

Post a Comment