bouchnina

exercice 2-2

Dec 6th, 2012
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include<stdio.h>
  2. float Min(float a,float b);
  3. float Max(float a,float b);
  4. int main()
  5. {
  6. float N,min,max;
  7. int i;
  8. printf("veuillez entrez 4 nombres :\nentrer le premier nombre :");
  9. scanf("%f",&N);
  10.     min=N;
  11.     max=N;
  12. for(i=2;i<=4;i++)
  13.     {
  14.     printf("entrez le %d nombre :",i);
  15.     scanf("%f",&N);
  16.     min=Min(min,N);
  17.     max=Max(max,N);
  18.     }
  19.  
  20. printf("le maximum est : %.2f \nle minimum est : %.2f\n",max,min);
  21. system("pause");
  22. return 0;
  23. }
  24. float Min(float a,float b)
  25. {
  26. float res;
  27. if(a<b) res=a;
  28. else if(b<a) res=b;
  29. return res;
  30. }
  31. float Max(float a,float b)
  32. {
  33. float res;
  34. if(a<b) res=b;
  35. else if(b<a) res=a;
  36. return res;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment