Calculate average of 10 student using c++
Object:
In this Post I am discuss how to write a c++ program to calculate average of 10 student and the basic understanding of while loop.
average=total/10;
Source Program:
OUTPUT:
In this Post I am discuss how to write a c++ program to calculate average of 10 student and the basic understanding of while loop.
Formula:
total += marks;average=total/10;
Source Program:
In in program declare fore variable called i=1 , marks , total=0 , average enter the marks for each student and store the total marks as in variable and calculate the average for 10 student.
#include "iostream"
using namespace std;
void main ()
{
int i=1 ,
marks , total=0 , average;
while ( i
<= 10 )
{
cout<<"Enter Marks Of "<<i<<" Student = ";
cin>>marks;
total += marks;
i++;
}
average=total/10;
cout<<"Total
Average Is "<<average<<endl;
}
OUTPUT:
The output should look like this.
Source Program:
The program is three variable called marks=0 , total=0 , average and declare while loop for check the user enter marks is greater then and equal to zero if user enter marks is less then zero the program is terminated and calculate the total marks.
Object:In this program I am discuss to write a program that converts feet to meters the program should display feet from 3 to 30 in 3 foot increment and corresponding meter equivalent use the relationship that there are 3.28 feet to a meter.
Source Program:
Output:
Enter Marks Of 1 Student = 4
Enter Marks Of 2 Student = 5
Enter Marks Of 3 Student = 4
Enter Marks Of 4 Student = 6
Enter Marks Of 5 Student = 4
Enter Marks Of 6 Student = 2
Enter Marks Of 7 Student = 1
Enter Marks Of 8 Student = 6
Enter Marks Of 9 Student = 4
Enter Marks Of 10 Student = 2
Total Average Is 3
Press any key to continue . . .
Object:
In this Post I am discuss how to calculate total of the marks. Input marks of student average value is entered this program is the basic understanding of if and else condition this program is write on c++.
Object:
In this Post I am discuss how to calculate total of the marks. Input marks of student average value is entered this program is the basic understanding of if and else condition this program is write on c++.
Source Program:
#include "iostream"
using namespace std;
void main()
{
int marks=0
, total=0 , average;
while (
marks >= 0 )
{
cout<<"Enter
Number = ";
cin>>marks;
if
(marks >= 0)
{
Total += marks;
}
else
{
break;
}
}
cout<<"Total
Marks = "<<total<<endl;
}
Output:
The output should look like this.
Enter Number = 50
Enter Number = 40
Enter Number = -60
Total Marks = 90
Press any key to continue . . .
Object:In this program I am discuss to write a program that converts feet to meters the program should display feet from 3 to 30 in 3 foot increment and corresponding meter equivalent use the relationship that there are 3.28 feet to a meter.
Source Program:
In in program declare five variable two variable called meter and declare while loop for check if i less then or equal to 30 and calculate the feet to meter.
#include "iostream"
using namespace std;
void main()
{
float
Meter=3.28;
int i=3;
while ( i <= 30 )
{
cout<<i<<" Feet "<<"
convert to "<<i/Meter<<"
Meter"<<endl;
i += 3;
}
}
Output:
The output should look like this.
OUTPUT:
The output should look like this.
3 Feet convert to 0.914634 Meter.
6 Feet convert to 1.82927 Meter.
9 Feet convert to 2.7439 Meter.
12 Feet convert to 3.65854 Meter.
15 Feet convert to 4.57317 Meter.
18 Feet convert to 5.4878 Meter.
21 Feet convert to 6.40244 Meter.
24 Feet convert to 7.31707 Meter.
27 Feet convert to 8.23171 Meter.
30 Feet convert to 9.14634 Meter.
Press any key to continue . . .
Object:
In this Post I am discuss to write a program Auto mobile travels at an average speed of 55 miles per hour for 4 hour write a program that displays the distance in miles that the car has travelled after 0.1,1,1.5 etc. hour unit the end of the trip.
Source Program:
In in program declare five variable M, T as datatype is float and declare while loop for check if T less then or equal to 4 and calculate the displays the distance in miles.Object:
In this Post I am discuss to write a program Auto mobile travels at an average speed of 55 miles per hour for 4 hour write a program that displays the distance in miles that the car has travelled after 0.1,1,1.5 etc. hour unit the end of the trip.
Source Program:
#include "iostream"
using namespace std;
void main()
{
float M=55
, T=0.5;
while
(T<=4)
{
cout<<T<<" Hours Travelled "<<T*M<<" Miles."<<endl;
T += 0.5;
}
}
The output should look like this.
0.5 Hours Travelled 27.5 Miles.
1 Hours Travelled 55 Miles.
1.5 Hours Travelled 82.5 Miles.
2 Hours Travelled 110 Miles.
2.5 Hours Travelled 137.5 Miles.
3 Hours Travelled 165 Miles.
3.5 Hours Travelled 192.5 Miles.
4 Hours Travelled 220 Miles.
Press any key to continue . . .