Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. package first_project;
  2.  
  3. public class Test {
  4.  
  5.  
  6. public static void main(String[] args) {
  7. float tab [] = {1,2,3,4,5,6,7,8,99,10};
  8. int i;
  9.  
  10. float Vmin;
  11. float Vmax;
  12. float somme;
  13. float Ltab;
  14. for (i = 0; i<tab.length ;i++) {
  15.  
  16. System.out.print(tab[i]);
  17. if (i!=tab.length-1)
  18. System.out.print(" ** ");
  19.  
  20.  
  21. }
  22. Vmin= tab[0];
  23. Vmax= tab[0];
  24. somme=0;
  25. Ltab=tab.length;
  26.  
  27.  
  28. for (i = 0; i<tab.length ;i++)
  29. {
  30. somme=somme+tab[i];
  31. if (tab[i]<Vmin) Vmin=tab[i];
  32.  
  33. else if (tab[i]>Vmax) Vmax=tab[i];
  34. }
  35. System.out.println(" ");
  36. System.out.println("la valeur min est "+Vmin);
  37. System.out.println("la valeur max est "+Vmax);
  38. System.out.println("la moyenne est "+somme/Ltab);
  39.  
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement