suppose we have top teams they are like that with their points
pakistan=99
india=52
bangladesh=80
Nz=72
sl=45
wi=84
now we have to find the top 3 teams
#include <iostream>
using namespace std;
int main(int argc, char *argv[]){
int sc[6];
for(int i = 0; i < 6;i++){
cin >> sc[i];
}
for(int i = 0; i<6; i++) {
for(int j = i+1; j<6; j++)
{
if(sc[j] > sc[i]) {
int temp = sc[i];
sc[i] = sc[j];
sc[j] = temp;
}
}
}
cout << sc[0] <<endl << sc[1] <<endl << sc[2] <<endl;
}
Comments
Leave a comment