Suppose there are three students in a class and their marks have been uploaded to the
software system, these students have applied for scholarship through online software system. The system should compare marks of these three students and should award scholarship to
the one with high marks.
#include <iostream>
using namespace std;
int main()
{
cout<<"Enter marks for the three students: "<<endl;
int marks1,marks2,marks3;
cout<<"\nEnter marks for student 1: ";
cin>>marks1;
cout<<"\nEnter marks for student 2: ";
cin>>marks2;
cout<<"\nEnter marks for student 3: ";
cin>>marks1;
int largest;
if ((marks1 >= marks2) && (marks1 >=marks3 ))
largest = marks1;
else if ((marks2 >= marks1) && (marks2 >= marks3))
largest = marks2;
else
largest = marks3;
cout<<"\nStudent with "<<largest<<" has won the scholarship";
return 0;
}
Comments
Leave a comment