Thursday, October 16, 2014

MARKSHEET PROGRAM USING C++



Prog 8:write a program to made a marksheet of any student for three subject and display percentage and class

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
char name[30];
int m1,m2,m3,tot=0;
float per;
cout<<"\n enter name of the student";
cin>>name;
cout<<"\n enter marks of three subject";
cin>>m1>>m2>>m3;
tot=m1+m2+m3; 
per=tot/3;
cout<<"\n Name :   "<<name<<endl;
cout<<"\n M1   :   "<<m1<<endl; 
 cout<<"\n M2   :   "<<m2<<endl;
cout<<"\n M3   :   "<<m3<<endl;
 cout<<"Total:   "<<tot<<endl;
cout<<"Per  :   "<<per<<endl
cout<<"Class:  ";
if(per>=70)
cout<<"Dist";
else if(per<70 && per>=60)
cout<<"First";
else if(per<60 && per>=50)
cout<<"Second";
else if(per<50 && per>=40)
cout<<"Pass";

else
cout<<"Fail";

getch();
}

Output:

enter name of the student kalpesh
enter marks of three subject 90 70 80

Name :   kalpesh
M1  :   90
M2  :   70
M3  :   80
Total:  240
Per :   80
Class:  Dist