Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class clase {
  4.  
  5. public static void main(String[] args) {
  6. //Scanner s = new Scanner(System.in);
  7. //String nom = s.nextLine();
  8. //mostrar(nom);
  9.  
  10. double aleatorio = aleat();
  11. double aleatorio2 = aleat();
  12. double res = sumar(aleatorio, aleatorio2);
  13. System.out.println(aleatorio + " + " + aleatorio2+ " = " + res);
  14. mostrar("Marc");
  15. System.out.println();
  16. double a = sumar(3.4, 5.8);
  17. System.out.println(a);
  18.  
  19.  
  20. }
  21. public static double sumar(double a, double b){
  22. return a+b;
  23. }
  24.  
  25. public static double aleat() {
  26. return Math.random()*10;
  27. }
  28.  
  29. public static void mostrar(String nom) {
  30. System.out.println("Me llamo " + nom);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement