Thursday, June 3, 2021

C++ program calculate the percentage and check the division of student (POP) (104)

#include<iostream>

using namespace std;

int main()

{

int rollnum,marks1,marks2,marks3,sum;

string name;

float percentage;

cout<<"please enter your roll number:";

cin>>rollnum;

cout<<"please enter your name:";

cin>>name;

cout<<"please enter your marks in english:";

cin>>marks1;

cout<<"please enter your marks in physics:";

cin>>marks2;

cout<<"please enter your marks in math:";

cin>>marks3;

sum=marks1+marks2+marks3;

cout<<"total marks:"<<sum<<endl;

percentage=sum*1000/100;

cout<<"percentage"<<percentage<<endl;

if(percentage >70 && percentage < 80)

{

cout<<"first division";

}

else if (percentage < 70 && percentage > 60)

{

cout<<"second division";

}

else

{

cout<<"you are fail"<<endl;

}

return 0;

} 

No comments:

Post a Comment