Hello, I am suppose to write program that displays number 1-50 and then also print HiFive next to the ones that are multiples of five, HiTwo if they are divisible by two and HiThreeOrSeven if they are divisibles of three or seven..
My problem is it is printing all three of them for every single number, here is my code.
public class QuestionFive {
public static void main(String[] args) {
int i = 1;
int num = 50;
String hiFive = "";
String hiTwo = "";
String hiThreeSeven = "";
while (i <= num) {
if (i % 5 == 0);
hiFive = "HiFive";
if (i % 2 == 0);
hiTwo = "HiTwo";
if (i % 3 == 0
|| i % 7 == 0);
hiThreeSeven = "HiThreeOrSeven";
i++;
System.out.println(i + "" + hiFive + "" + hiTwo + ""
+ hiThreeSeven);
}
}
}