scar1
1
My issue
My code
#include <stdio.h>
int main() {
// your code goes here
int t,x,y;
scanf("%d",&t);
printf("\n");
scanf("%d",&x);
scanf("%d",&y);
while(t--)
{ if((x+y)>6)
{printf("yes\n");
}
else{
printf("no\n");
}
}
return 0;
}
Problem Link: GDTURN Problem - CodeChef
you had inistialised the value of x and y outside the loop which can effect your variable both localy and globaly .
To understand the inialisation of variable for local and global , you can refer my discuss section
of initialisation.
LINK::
LOCAL AND GLOBAL INITIALISATION abhaypandey114 & amnkhxn - CodeChef Discuss
C CODE:
#include <stdio.h>
int main() {
// your code goes here
int t,x,y;
scanf("%d",&t);
printf("\n");
while(t--){
scanf("%d",&x);
scanf("%d",&y);
{ if((x+y)>6)
{printf("yes\n");
}
else{
printf("no\n");
}
}
}
return 0;
}
MY C++ CODE:
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int x,y;
cin>>x>>y;
int f;
f= x+y;
if(f>6){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
return 0;
}