/* Question :-
A class contains 'b' number of boys and 'g' number of girls. On a rainy day, 'ba' number of boys and 'ga' number of girls are absent. Write a program to input the values of 'b', 'g', 'ba' and 'ga'. Calculate and display the following:
(i) Percentage of girls present in the class.
(ii) Percentage of boys present in the class.
[Percentage must be calculated on the total number of Students]
*/
#include <iostream>
using namespace std;
int main()
{
int b,g,ba,ga;
float per_boys,per_girls;
cout<<"Enter the number of boys and girls in the class\n";
cin>>b>>g;
cout<<"Enter the number of boys and girls in the class who were absent\n";
cin>>ba>>ga;
per_girls=(float)(g-ga)/(g+b)*100;
per_boys=(float)(b-ba)/(g+b)*100;
cout<<"The Percentage of girls Present in the class : "<<per_girls<<"%\n";
cout<<"The Percentage of boys Present in the class : "<<per_boys<<"%\n";
}
No comments:
Post a Comment