What is the answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the answer

int num1 = 10; int num2 = 10; int num3 = 10; int num4 = 20; // Do Not Edit Any Condition // Condition 1 if (num1 > num2) cout << "Condition 1 Is True\n"; else cout << "Condition 1 Is False\n"; // Condition 2 if (num1 > num2 && num1 < num4) cout << "Condition 2 Is True\n"; else cout << "Condition 2 Is False\n"; // Condition 3 if (num1 > num2 && num1 == num3) cout << "Condition 3 Is True\n"; else cout << "Condition 3 Is False\n"; // Condition 4 if (num1 + num2 < num4) cout << "Condition 4 Is True\n"; else cout << "Condition 4 Is False\n"; // Condition 5 if (num1 + num3 < num4) cout << "Condition 5 Is True\n"; else cout << "Condition 5 Is False\n"; // Condition 6 if (num1 + num2 + num3 < num4) cout << "Condition 6 Is True\n"; else cout << "Condition 6 Is False\n"; // Condition 7 if (num4 - (num1 + num3) + num2 == 21) cout << "Condition 7 Is True\n"; else cout << "Condition 7 Is False\n"; // Output Needed "Condition 1 Is True" "Condition 2 Is True" "Condition 3 Is True" "Condi

21st Mar 2023, 10:05 AM
Ahmed Yousef
Ahmed Yousef - avatar
6 Answers
+ 5
Ahmed Yousef , > it looks like you posted this multiple times. > what is your issue or question?
21st Mar 2023, 12:04 PM
Lothar
Lothar - avatar
+ 2
you do realize that none of the conditions evaluate to true? all you are going to get is all the else clauses. or maybe you mean solve for num1 to 4 so that all is true?
21st Mar 2023, 10:13 AM
Bob_Li
Bob_Li - avatar
0
there are multiple answers for this int num1 = 11; int num2 = 10; int num3 = 11; int num4 = 33; or int num1 = -1; int num2 = -2; int num3 = -1; int num4 = 21; or anything at all. Just add or subtract the same number for all variables to get a set that will satisfy the conditions
21st Mar 2023, 12:23 PM
Bob_Li
Bob_Li - avatar
21st Mar 2023, 4:35 PM
Bob_Li
Bob_Li - avatar
0
"Condition 1 Is True" "Condition 2 Is True" "Condition 3 Is True" "Condition 4 Is False" "Condition 5 Is False" "Condition 6 Is False" "Condition 7 Is True"
23rd Mar 2023, 5:47 AM
Anthony Warner
Anthony Warner - avatar
0
Condition 1: num1 is equal to num2, so the condition is false. Condition 2: num1 is less than num4, so the condition is true. Condition 3: num1 is equal to num3, so the condition is true. Condition 4: The sum of num1 and num2 is equal to 20, which is not less than num4 (20), so the condition is false. Condition 5: The sum of num1 and num3 is equal to 20, which is not less than num4 (20), so the condition is false. Condition 6: The sum of num1, num2, and num3 is equal to 30, which is not less than num4 (20), so the condition is false. Condition 7: num4 - (num1 + num3) + num2 is equal to 21, so the condition is true
23rd Mar 2023, 5:50 AM
Anthony Warner
Anthony Warner - avatar