Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package myApp;
- import java.util.Scanner;
- public class class03_ex09 {
- public static void main(String[] args) {
- //init vars
- int n = 1;
- //open in_stream
- Scanner s = new Scanner(System.in);
- //usage info
- System.out.print("Type in XY, where X=Y (ex. 99): ");
- /* while left digit does not equal right digit, OR num equals 0, do:
- - accept new n value
- else, continue with the program ;) */
- while (n%10 != n/10 || n==0) {
- n = s.nextInt();
- }
- //close in_stream
- s.close();
- //exit msg
- System.out.printf("number %d accepted. exit..%n", n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment