10. Program that inputs total number of student in a class and fee per student. It displays total fee collected from the class.

Chapter 4: 

Input And Output

Programming Exercise

Problem # 10:

Write a program that inputs total number of student in a class and fee per student. It displays total fee collected from the class.

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    int noOfStudents, feePerStudent, totalFeeCollected;
    cout<<"Enter total no. of students : ";
    cin>>noOfStudents;
    cout<<"Enter fee per student : ";
    cin>>feePerStudent;
    totalFeeCollected = noOfStudents * feePerStudent;
    cout<<"Total fee collected from the class : "<< totalFeeCollected<<endl;
    return 0;
}

Code Screenshot:

Chapter 4, Coding tutorial, Computer Science, CPP Basics, Exercise Solution, Input and Output, IT Series, Object Oriented Programming using C++, Programming for beginners, Programming Tutorial

Output:

Chapter 4, Coding tutorial, Computer Science, CPP Basics, Exercise Solution, Input and Output, IT Series, Object Oriented Programming using C++, Programming for beginners, Programming Tutorial

Let me know in the comment section if you have any question.

Previous Post:
9. Program that inputs petrol in liters and displays how much distance the car can cover using the available petrol.

Comments