Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Java

what program that add all integer number from 1-20 except 11,12

8th Oct 2022, 8:21 PM
Roo s
7 Answers
+ 2
You could use a for-loop to add the number. You could either check on each iteration if the current number is 11 or 12 and skip them if so. Or you add up all numbers to 20 and simply subtract 11 and 12 after the loop.
8th Oct 2022, 8:25 PM
Lisa
Lisa - avatar
+ 2
Roo s If you are a beginner, a better approach would be to do the Java course. Just asking a lot of point questions, without learning the basic, won't help you much.
9th Oct 2022, 1:09 AM
Emerson Prado
Emerson Prado - avatar
+ 1
Check by if statment or what sorry but I am begginer in java
8th Oct 2022, 8:29 PM
Roo s
+ 1
if(i == 11 || i == 12) continue;
8th Oct 2022, 8:49 PM
Ausgrindtube
Ausgrindtube - avatar
0
Yes, you can use the if-statement for checking.
8th Oct 2022, 8:30 PM
Lisa
Lisa - avatar
0
Yeeees its work Thank you All ❤️❤️
8th Oct 2022, 9:08 PM
Roo s
- 1
May you tell if my statment correct or not if(i=11 && i=12) How I can told the program except them?
8th Oct 2022, 8:48 PM
Roo s