//Multiplying until 100 with while
// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
// then press Enter. You can now see whitespace characters in your code.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int no1;
double res;
int h;
h = 1;
res = 0;
// Press Alt+Enter with your caret at the highlighted text to see how
System.out.println("Multiplying until 100");
System.out.println("Enter any number");
Scanner a = new Scanner(System.in);
no1 = a.nextInt();
while (res < 100) {
if(res <= 100){
System.out.println(no1 + " * " + h + " = " + res);
}
h++;
res = no1 * h;
}
}
}
Comments