COMPUTER PROGRAMMING FUNDAMENTALS
WHAT IS PROGRAMMING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
How to INPUT sum of 5 numbers
|
INPUT 1, 2, 3, 4, 5
|
|
INPUT A, B, C, D, E
|
|
Either A or B
|
|
None of the above
|
Explanation:
Detailed explanation-1: -If you want to accept five, you’ll need to call nextInt() five times. You could do that in a loop, or just with five calls. You need to limit integer input to max 5 such as(1 to 5) or something else such as combination of five like (12548, 85698)?
Detailed explanation-2: -s = 0 for i in range(5): try: s += int(raw input(’Enter a number: ‘)) except ValueError: print ‘Invalid input.
There is 1 question to complete.