0

print 1 to 10 numbers using if condition but escape 8th number in the row

7th Oct 2016, 6:41 AM
Venkatesh Devara
Venkatesh Devara - avatar
2 odpowiedzi
+ 4
Just use a loop, much easier: for(int i = 1; i <=10; i++){ if(i != 8 ){ //print i } }
7th Oct 2016, 7:46 AM
Ousmane Diaw
+ 1
Or use the modulus operator to print out each 8th element in a row if your row has more than, let's say 16
7th Oct 2016, 12:01 PM
Eric Gitangu
Eric Gitangu - avatar