public class DoWhile {
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
int n;
System.out.print("Enter an integer : ");
while((n=myScanner.nextInt())!=0){
System.out.print("You entered "+n+"\n");
System.out.print("Input an integer : ");
}
}
}
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
int n;
System.out.print("Enter an integer : ");
while((n=myScanner.nextInt())!=0){
System.out.print("You entered "+n+"\n");
System.out.print("Input an integer : ");
}
}
}
No comments:
Post a Comment