commit inicial
commit
6adccc33f9
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.mycompany.while1;
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author 250422
|
||||||
|
*/
|
||||||
|
public class While1 {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
System.out.println("Introduza um número positivo");
|
||||||
|
int numero = scanner.nextInt();
|
||||||
|
while(numero <0){
|
||||||
|
System.out.println("Introduza um número positivo");
|
||||||
|
numero = scanner.nextInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue