How to display out? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to display out?

Output: 1 2 3 hoo 4 5 haa 6 hoo 7haz 8 9 hoo 10 haa 11 12 hoo 13 14haz . . .until 50 https://code.sololearn.com/ciS55K43EsGq/?ref=app

3rd May 2021, 5:34 PM
Kyrene
7 Answers
+ 2
https://code.sololearn.com/cPGVE7Zmc2r5/?ref=app
3rd May 2021, 5:57 PM
Atul [Inactive]
+ 4
public class Labpractical1 { public static void main(String args[]) { for (int i=1; i<=50; i++) { if (i%3==0) System.out.println(i+" hoo"); else if (i%5==0) System.out.println(i +" haa"); else if (i%7==0) System.out.println(i +" haz"); else System.out.println(i); } } } //Are you expecting this?
3rd May 2021, 5:38 PM
Atul [Inactive]
+ 3
Are you expecting 15 hoo haa?
3rd May 2021, 5:50 PM
Atul [Inactive]
0
Yes but 15 hoo haa
3rd May 2021, 5:41 PM
Kyrene
0
Yes
3rd May 2021, 5:50 PM
Kyrene
0
Create an application that loops from 1 to 50 and prints out each value on a separate line, except print out “hoo” for every multiple of 3, “haa” for every multiple of 5, and “haz” for every multiple of 7.
3rd May 2021, 5:51 PM
Kyrene
0
Thank you 🥰
4th May 2021, 1:05 AM
Kyrene