8 Answers
New Answerpublic 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?
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.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message