From 35e0eaf644a60932ea0aec2581dfa8a8c21d2357 Mon Sep 17 00:00:00 2001 From: 250410 <250410@localhost> Date: Tue, 11 Nov 2025 11:22:29 +0000 Subject: [PATCH] commit inicial --- pom.xml | 13 ++++++++++ .../whileexercicio1/WhileExercicio1.java | 26 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/com/mycompany/whileexercicio1/WhileExercicio1.java diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d9f60eb --- /dev/null +++ b/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + com.mycompany + WhileExercicio1 + 1.0-SNAPSHOT + jar + + UTF-8 + 24 + com.mycompany.whileexercicio1.WhileExercicio1 + + \ No newline at end of file diff --git a/src/main/java/com/mycompany/whileexercicio1/WhileExercicio1.java b/src/main/java/com/mycompany/whileexercicio1/WhileExercicio1.java new file mode 100644 index 0000000..d3ba88e --- /dev/null +++ b/src/main/java/com/mycompany/whileexercicio1/WhileExercicio1.java @@ -0,0 +1,26 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package com.mycompany.whileexercicio1; + +import java.util.Scanner; + +/** + * + * @author 250410 + */ +public class WhileExercicio1 { + + 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(); + +} + } +}