+ 1

Write a program that print all the integers between 100 and 150 which are divisible by 8 in descending order.

Output: 144 136 128 120 112 104

11th Nov 2020, 3:30 PM
Marop Hossain
Marop Hossain - avatar
4 Réponses
+ 4
The faster solution as above will be: for(int i=150; i>=100; i--){ if(i%8 == 0){ System.out.println(i); } }
11th Nov 2020, 3:46 PM
JaScript
JaScript - avatar
+ 1
You can loop it reverse. Simply do from 150 to 100.
11th Nov 2020, 3:40 PM
Jayakrishna 🇮🇳
0
But How do I decending order?
11th Nov 2020, 3:36 PM
Marop Hossain
Marop Hossain - avatar