#include <iostream.h>
#include <conio.h>
int main ()
{
clrscr ();
int student;
float a=0,b=0;
float p=0;
float f=0;
int n=0;
char g=' ';
cout <<"Enter The Number Of Students : ";
cin >> student;
cout <<endl;
while (n<student)
{
cout <<"Enter A Grade : ";
cin >> g;
switch (g)
{
case 'a':
case 'b':
case 'c':
case 'd': ++p;
break;
case 'f': ++f;
}
n++;
}
a=((p/student)*100);
b=((f/student)*100);
cout << p <<" Students Are Passed "<< a <<" % "<<endl;
cout << f <<" Students Are Failed " << b <<" % "<<endl;
getch();
return 0;
}
#include <conio.h>
int main ()
{
clrscr ();
int student;
float a=0,b=0;
float p=0;
float f=0;
int n=0;
char g=' ';
cout <<"Enter The Number Of Students : ";
cin >> student;
cout <<endl;
while (n<student)
{
cout <<"Enter A Grade : ";
cin >> g;
switch (g)
{
case 'a':
case 'b':
case 'c':
case 'd': ++p;
break;
case 'f': ++f;
}
n++;
}
a=((p/student)*100);
b=((f/student)*100);
cout << p <<" Students Are Passed "<< a <<" % "<<endl;
cout << f <<" Students Are Failed " << b <<" % "<<endl;
getch();
return 0;
}