My issue
My code
# cook your dish here
Problem Link: GDTURN Problem - CodeChef
@arnab003jn369
Here, the question is providing us with two values, namely x and y, denoting the number obtained after rolling a dice.
A dice has 6 faces having 6 distinct values (1,2,3,4,5,6). We need to find if the sum of (x+y) is greater than 6 or not.
# cook your dish here
for i in range(int(input())):
x,y=map(int,input().split())
if((x+y)>6):
print('yes')
else:
print('no')
Here, the question asked us to check whether the addition of two numbers is more than 6 or not?
If it is more than 6 than it should return “YES” and if it is not than it should return “NO”.
Here is the sample code for you -
#include <iostream>
using namespace std;
int main()
{
int t,x,y;
cin >> t;
for(int i = 0; i < t; i++){
cin >> x >> y;
if(x+y > 6){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
}
return 0;
}
Hope this will help you.
include <stdio.h>
int main(void) {
// your code goes here
int t,x,y,i,sum;
scanf(“%d”,&t);
for( i=0;i<t;i++)
{
scanf("%d %d",&x,&y);
sum=x+y;
if(sum >6)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}
In this program they have asked to see whether the sum of the dices is greater than 6.I have used t denoting the number of test case. I have taken x, y variables as the numbers on the dices, then I have used sum variable to add both the values then in if condition I have compared whether the sum is greater than 6 or not .If the sum is greater than 6 then yes is the answer otherwise no is the answer.