Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- float min = 0, max = 0, nbre = 0, somme = 0, input = 0, moyenne = 0;
- Scanner scan = new Scanner(System.in);
- System.out.println("Nouvelle valeur :");
- input = scan.nextInt();
- max = input;
- min = input;
- somme += input;
- while (input != 0) {
- System.out.println("Nouvelle valeur :");
- input = scan.nextInt();
- if (input > max) {
- max = input;
- } else if (input < min && input != 0) {
- min = input;
- }
- nbre++;
- somme += input;
- }
- if(nbre == 0) {
- System.out.println("Grand fou !");
- } else {
- moyenne = (somme / nbre);
- }
- System.out.println("Max :" + max);
- System.out.println("Min :" + min);
- System.out.println("Moyenne :" + moyenne);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement