Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /* ==================================================
- Chapter 2: Syntax section B- Loops
- Ex7: Triple digit number X7
- ===================================================
- */
- public class MyProgram {
- public static void main(String[] args) {
- //variables
- int number;
- Scanner s=new Scanner(System.in);
- //user input
- System.out.println("\nEnter a Triple digit number X7: ");
- number=s.nextInt();
- //loop until Triple digit number multiplied by 7
- while((number<100 || number>999) || number%7!=0) {
- System.out.println("Try again: ");
- number=s.nextInt();
- }
- System.out.println("Triple digit number X7 !\n***End***");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment