===========================================================================
CODING
#include<conio.h>
#include<iostream.h>
#include<string.h>
void main()
{
clrscr();
char n1[20],n2[20],n3[20];
float m11,m12,m13,m21,m22,m23,m31,m32,m33,P1,P2,P3;
cout<<"[1]\n Enter Your Name: ";
cin>>n1;
cout<<"\n ¯Enter Marks in Maths: ";
cin>>m11;
cout<<"\n ¯Enter Marks in Science: ";
cin>>m12;
cout<<"\n ¯Enter Marks in English: ";
cin>>m13;
cout<<"\n[2]\n Enter Your Name: ";
cin>>n2;
cout<<"\n ¯Enter Marks in Maths: ";
cin>>m21;
cout<<"\n ¯Enter Marks in Science: ";
cin>>m22;
cout<<"\n ¯Enter Marks in English: ";
cin>>m33;
cout<<"\n[3]\n Enter Your Name: ";
cin>>n3;
cout<<"\n ¯Enter Marks in Maths: ";
cin>>m31;
cout<<"\n ¯Enter Marks in Science: ";
cin>>m32;
cout<<"\n ¯Enter Marks in English: ";
cin>>m33;
P1=(m11+m12+m13)/3;
P2=(m21+m22+m23)/3;
P3=(m31+m32+m33)/3;
if(P1>P2 && P1>P3)
{
if(P2>P3)
cout<<"\n\n"<<n1<<">"<<n2<<">"<<n3<<"\n\n"<<n1<<" has "<<P1-P2<<" greater than "<<n2<<" and "<<n2<<" has "<<P2-P3<<" greater than "<<n3;
else if(P3>P2)
cout<<"\n\n"<<n1<<">"<<n3<<">"<<n2<<"\n\n"<<n1<<" has "<<P1-P3<<" greater than "<<n3<<" and "<<n3<<" has "<<P3-P2<<" greater than "<<n2;
}
if(P2>P3 && P2>P1)
{
if(P1>P3)
cout<<"\n\n"<<n2<<">"<<n1<<">"<<n3<<"\n\n"<<n2<<" has "<<P2-P1<<" greater than "<<n1<<" and "<<n1<<" has "<<P1-P3<<" greater than "<<n3;
else if(P3>P1)
cout<<"\n\n"<<n2<<">"<<n3<<">"<<n1<<"\n\n"<<n2<<" has "<<P2-P3<<" greater than "<<n3<<" and "<<n3<<" has "<<P3-P1<<" greater than "<<n1;
}
if(P3>P2 && P3>P1)
{
if(P2>P1)
cout<<"\n\n"<<n3<<">"<<n2<<">"<<n1<<"\n\n"<<n3<<" has "<<P3-P2<<" greater than "<<n2<<" and "<<n2<<" has "<<P2-P1<<" greater than "<<n1;
else if(P1>P2)
cout<<"\n\n"<<n3<<">"<<n1<<">"<<n2<<"\n\n"<<n3<<" has "<<P3-P1<<" greater than "<<n1<<" and "<<n1<<" has "<<P1-P2<<" greater than "<<n2;
}
getch();
}
CODING
#include<conio.h>
#include<iostream.h>
#include<string.h>
void main()
{
clrscr();
char n1[20],n2[20],n3[20];
float m11,m12,m13,m21,m22,m23,m31,m32,m33,P1,P2,P3;
cout<<"[1]\n Enter Your Name: ";
cin>>n1;
cout<<"\n ¯Enter Marks in Maths: ";
cin>>m11;
cout<<"\n ¯Enter Marks in Science: ";
cin>>m12;
cout<<"\n ¯Enter Marks in English: ";
cin>>m13;
cout<<"\n[2]\n Enter Your Name: ";
cin>>n2;
cout<<"\n ¯Enter Marks in Maths: ";
cin>>m21;
cout<<"\n ¯Enter Marks in Science: ";
cin>>m22;
cout<<"\n ¯Enter Marks in English: ";
cin>>m33;
cout<<"\n[3]\n Enter Your Name: ";
cin>>n3;
cout<<"\n ¯Enter Marks in Maths: ";
cin>>m31;
cout<<"\n ¯Enter Marks in Science: ";
cin>>m32;
cout<<"\n ¯Enter Marks in English: ";
cin>>m33;
P1=(m11+m12+m13)/3;
P2=(m21+m22+m23)/3;
P3=(m31+m32+m33)/3;
if(P1>P2 && P1>P3)
{
if(P2>P3)
cout<<"\n\n"<<n1<<">"<<n2<<">"<<n3<<"\n\n"<<n1<<" has "<<P1-P2<<" greater than "<<n2<<" and "<<n2<<" has "<<P2-P3<<" greater than "<<n3;
else if(P3>P2)
cout<<"\n\n"<<n1<<">"<<n3<<">"<<n2<<"\n\n"<<n1<<" has "<<P1-P3<<" greater than "<<n3<<" and "<<n3<<" has "<<P3-P2<<" greater than "<<n2;
}
if(P2>P3 && P2>P1)
{
if(P1>P3)
cout<<"\n\n"<<n2<<">"<<n1<<">"<<n3<<"\n\n"<<n2<<" has "<<P2-P1<<" greater than "<<n1<<" and "<<n1<<" has "<<P1-P3<<" greater than "<<n3;
else if(P3>P1)
cout<<"\n\n"<<n2<<">"<<n3<<">"<<n1<<"\n\n"<<n2<<" has "<<P2-P3<<" greater than "<<n3<<" and "<<n3<<" has "<<P3-P1<<" greater than "<<n1;
}
if(P3>P2 && P3>P1)
{
if(P2>P1)
cout<<"\n\n"<<n3<<">"<<n2<<">"<<n1<<"\n\n"<<n3<<" has "<<P3-P2<<" greater than "<<n2<<" and "<<n2<<" has "<<P2-P1<<" greater than "<<n1;
else if(P1>P2)
cout<<"\n\n"<<n3<<">"<<n1<<">"<<n2<<"\n\n"<<n3<<" has "<<P3-P1<<" greater than "<<n1<<" and "<<n1<<" has "<<P1-P2<<" greater than "<<n2;
}
getch();
}
===========================================================================
No comments:
Post a Comment