Compare the triplets
Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a[3]; //1st array
int b[3]; //2nd array
// the array size will be fixed that is 3 as given in the problem
int x=0; //to store score of 1st
int y=0; //to store score of 2nd
for(int i=0;i<3;i++){ //1st array
cin>>a[i];
}
for(int i=0;i<3;i++){ //2nd array
cin>>b[i];
}
for(int i=0;i<3;i++){ //loop to compare
if(a[i]>b[i]){
x++;
}
else if(a[i]<b[i]){
y++;
}
}
cout<<x<<" "<<y; //print the scores
return 0;
}
0 Comments