If the keyboard input is 15, what is the value of score after this code executes? Scanner sc = new Scanner(System.in); int score = 80; System.out.print("Enter a score value: "); int input = sc.nextInt(); if (input < 10) { score = 50; } else if (input >= 10 && input <= 20) { score = 60; } else { score = 70; } score = score + 5; System.out.println("Final Score: \t" + score);单项选择题
A
65
B
60
C
50
D
70
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
If the input is 5, what is the output? int x; cin >> x; if (x < 10) { cout << "Live "; } else if (x < 20) { cout << "long "; } else if (x < 30) { cout << "and "; } cout << "prosper!";
What gets printed to the console if the user enters 'Metal':
For the given program, how many cout statements will execute? void PrintShippingCharge(double itemWeight) { if ((itemWeight > 0.0) && (itemWeight <= 10.0)) { cout << (itemWeight * 0.75) << endl; } else if ((itemWeight > 10.0) && (itemWeight <= 15.0)) { cout << (itemWeight * 0.85) << endl; } else if ((itemWeight > 15.0) && (itemWeight <= 20.0)) { cout << (itemWeight * 0.95)<< endl; } } int main() { PrintShippingCharge(18); PrintShippingCharge(6); PrintShippingCharge(25); return 0; }
If the value 50 was input as Score what would be the output of the above program?
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!