commit 60b8b46ad4085677f94a088c5521749ea5cd0c66 Author: 250409 <250409@localhost> Date: Tue Nov 18 11:44:45 2025 +0000 Exercicios for diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..22b6ae7 --- /dev/null +++ b/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + com.mycompany + for_exercicio15 + 1.0-SNAPSHOT + jar + + UTF-8 + 24 + com.mycompany.for_exercicio15.For_exercicio15 + + \ No newline at end of file diff --git a/src/main/java/com/mycompany/for_exercicio15/For_exercicio15.java b/src/main/java/com/mycompany/for_exercicio15/For_exercicio15.java new file mode 100644 index 0000000..b619c34 --- /dev/null +++ b/src/main/java/com/mycompany/for_exercicio15/For_exercicio15.java @@ -0,0 +1,84 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package com.mycompany.for_exercicio15; + +/** + * + * @author 250409 + */ +/*public class For_exercicio15 { + + public static void main(String[] args) { + for(int i = 2; i <= 1000; i++) + { + boolean primo = true; + for(int j = 2; j < i; j++) + { + if (i % j == 0) + { + primo = false; + break; + } + } + if(primo) + { + System.out.println(i); + } + } + } +} +*/ + +/*public class For_exercicio14 { + + 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("Número inválido. Introduza novamente"); + numero = scanner.nextInt(); + } + + for(int i = 0; i < numero; i++) + { + if(i % 2 != 0) + { + System.out.println(i); + } + } + } +} +*/ + +/*public class For_exercicio13 { + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + for(int i = 0; i <= 1000; i++){ + System.out.println(i); + + } + } +} +*/ + +/* +/*public class For_exercicio2 { + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + double soma = 0; + for (int mes = 1; mes <= 12; mes++) { + System.out.print("Introduza o valor da fatura do mês "); + double fatura = scanner.nextDouble(); + soma += fatura; + } + double media = soma / 12; + System.out.printf("O valor médio das faturas de eletricidade é: " + media); + } +} +*/ \ No newline at end of file