Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. package DoWhile;
  4.  
  5. public class Do {
  6.  
  7.  
  8. public static void main(String[] args) {
  9. Scanner leer = new Scanner(System.in);
  10. int opcion , n1 , n2 , res;
  11.  
  12. do{
  13. System.out.println("1.- Suma de dos numeros");
  14. System.out.println("2.- Multiplicacion de dos numeros");
  15. System.out.println("0.- Salir");
  16. System.out.println("1.- Selecciona una opcion");
  17.  
  18. opcion = leer.nextInt();
  19.  
  20.  
  21. switch(opcion)
  22. {
  23. case 1: System.out.print("Dame el primer numero :"); n1 = leer.nextInt();
  24. System.out.print("Dame el segundo numero :"); n2 = leer.nextInt();
  25. res= n1+ n2;
  26. System.out.print("El resulado de la suma es : "+res);n1 = leer.nextInt();
  27. break;
  28. case 2:
  29.  
  30. }
  31.  
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement