Why is there no output coming in this problem ?
#include <iostream>
using namespace std;
int main() {
int t;
while(t){
int a, b, a1, b1, a2, b2;
cin >> a >> b >> a1 >> b1 >> a2 >> b2;
if(((a+b == a1 + b1) & (a == a1 | a == b1))){
cout << "1" << endl;
}
else if(((a+b == a2 + b2) & (a == a2 | a == b2))){
cout << "2" << endl;
}
else{
cout << "0" << endl;
}
t--;
}
return 0;
}
@achintyavarsh - which problem is this?
@achintyavarsh you have not taken input of t .
ie cin>>t;
1 Like
Name: Programming Languages
Problem Code: PROGLANG
Contest Code:LTIME99
Difficulty Rating:1001
You have not taken input to ‘t’ therefore it will not enter into the while loop and another mistake is in if condition use ‘&&’ this to make logical and operation
int main() {
int t;
cin>>t;
while(t–){
//then the above code will run
Explaination–
//1) actually here you had not taken input value of t and thus it’s not going forward so we have to take value of t and in while condition give the value as (t–) instead of t
2) also used & instead of && operator
cin>>t is missing. also the and operator should be replaced by &&
Try to take Input for testcases.