> exercicio 1 ``` import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.println("n1: "); int n1 = scan.nextInt(); if(n1 >= 100){ int n2 = n1 + 150; System.out.println("a soma de "+n1+" + 150 = "+n2); }else{ System.out.println("o numero digitado é menor que 100"); } } } ``` > exercicio 2 ``` import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.println("n1: "); int n1 = scan.nextInt(); System.out.println("n2: "); int n2 = scan.nextInt(); float div = n1%n2; if(div == 0){ System.out.println("a divisão de "+n1+" por "+n2+" é exata"); }else{ System.out.println("essa divisão de "+n1+" por "+n2+" não é exata"); } } } ``` > exercicio 3 ``` import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.println("quanto vc pesa? "); float M = scan.nextFloat(); System.out.println("qual a sua altura? "); float A = scan.nextFloat(); float imc = M/(A*A); System.out.println("o seu imc é igual a: "+imc); if (imc < 26) { System.out.println("normal"); } else if(imc >= 26 && imc < 30){ System.out.println("obeso"); }else{ System.out.println("obeso mórbido"); } } } ``` > exercicio 4 ``` import java.util.Scanner; class Main { public static void main(String[] args) { float conta; Scanner scan = new Scanner (System.in); System.out.println("consumo de energia (kWh): "); float kwh = scan.nextFloat(); if(kwh < 60){ System.out.println("o valor a pagar é: 11.90R$"); }else if(kwh >= 60 && kwh < 150){ conta = (kwh*20)/100; System.out.println("o valor a pagar é: "+conta+"R$"); }else if(kwh >= 150 && kwh < 500){ conta = (kwh*25)/100; System.out.println("o valor a pagar é: "+conta+"R$"); }else{ conta = (kwh*30)/100; System.out.println("o valor a pagar é: "+conta+"R$"); } } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up