Advertisement
cesarnascimento

ex 2 int a comp

May 7th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. package ex1;
  2. import java.util.Scanner;
  3. public class ex12 {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner sc = new Scanner(System.in);
  7.         System.out.println("Digite o primeiro número: ");
  8.         int primeiro = sc.nextInt();
  9.         System.out.println("Digite o segundo número: ");
  10.         int segundo = sc.nextInt();
  11.         if(segundo == 0){
  12.             System.out.println("O segundo número não pode ser 0.");
  13.         }
  14.         else{
  15.             int resultado = primeiro / segundo;
  16.             System.out.println("O resultado é:" +resultado);
  17.         }
  18.  
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement