Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class EJ5 {
  4. public static void main (String[] args) {
  5. Scanner sce=new Scanner(System.in);
  6. float n1,n2,suma,div;
  7. int r=1;
  8.  
  9. do {
  10.  
  11. System.out.println("Ingrese un valor:");
  12. n1=sce.nextFloat();
  13. if (n1<=255 & n1>=30) {
  14. System.out.println("Ingrese otro valor.");
  15. n2=sce.nextFloat();
  16. suma=n1+n2;
  17. System.out.println("El resultado de la suma es:"+suma);
  18. }else {
  19. if(n1>0) {
  20. div=n1/2;
  21. System.out.println("El resultado de la division es:"+div);}
  22. }
  23.  
  24. System.out.println("¿Desea continuar?Si=1 o No=0");
  25. r=sce.nextInt();
  26. }
  27. while (r!=0);
  28.  
  29.  
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement