I want to display multiples of 5 from 0 to 30 but not using normal logic. Tried with Ternary operator to display the result.
int i=0;
while(++i<=30)
System.out.print(i%5==0?i:" ");
Output
5 10 15 20 25
I don't want any spaces to be printed so instead on " " in the above code I tried with continue statement to proceed with the loop but it did not worked.
System.out.print(i%5==0?i:continue);
This code throws invalid expression. Why apart from expression special instructions did not work. Please help me in giving expression that do nothing in the ternary operator.