bouchnina

max min Entre 0 et 20

Dec 12th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int N,Max=0,Min=0,nbrMin=1,nbrMax=1;
  5. printf("Entrez une note entre (0 et 20) :\n ");
  6. scanf("%d",&N);
  7. Min=N;
  8.  
  9. do{
  10.     printf("donner une note (-1 pour finir);");
  11.     scanf("%d",&N);
  12.     if(N==-1) break;;
  13.     if(N>Max) Max=N;
  14.         else if(N==Max) nbrMax++;
  15.     if(N<Min) Min=N;
  16.         else if(N==Min) nbrMin++;
  17.     }while(N>=0 && N<=20);
  18. printf("la NOTE Maximale est %d attribues %d fois\n",Max,nbrMax);
  19. printf("la NOTE Minimal est %d attribues %d fois\n",Min,nbrMin);
  20.  
  21. printf("\n\n");
  22. system("pause");
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment