//WAP to calculate division obtain by students using else if condition statement.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int m1,m2,m3,per;
cout<<"enter the marks of enlish";
cin>>m1;
cout<<"enter the marks of maths";
cin>>m2;
cout<<"enter the manrks of science";
cin>>m3;
per=(m1+m2+m3)/3;
if(m1>=40 && m2>=40 && m3>=40)
{
if(per>=60)
{
cout<<"first division"<<per<<" "<<per<<"%";
}
else if(per>=50)
{
cout<<"second division"<<" "<<per<<"%";
}
else if(per>=40)
{
cout<<"third division"<<" "<<per<<"%";
}
}
else
{
cout<<"you are fail in one or more subjects";
}
getch();
}
Output:-
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int m1,m2,m3,per;
cout<<"enter the marks of enlish";
cin>>m1;
cout<<"enter the marks of maths";
cin>>m2;
cout<<"enter the manrks of science";
cin>>m3;
per=(m1+m2+m3)/3;
if(m1>=40 && m2>=40 && m3>=40)
{
if(per>=60)
{
cout<<"first division"<<per<<" "<<per<<"%";
}
else if(per>=50)
{
cout<<"second division"<<" "<<per<<"%";
}
else if(per>=40)
{
cout<<"third division"<<" "<<per<<"%";
}
}
else
{
cout<<"you are fail in one or more subjects";
}
getch();
}
Output:-
No comments:
Post a Comment