Advertisement
nguyenhappy92

Viết chương trình tìm số nhỏ nhì trong 3 số nguyên a, b, c

Oct 16th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. // Xuat ra so nho nhi 3 so a,b,c
  2. // Khai bao ham thu vien neu co
  3. #include<stdio.h>
  4. #include<conio.h>
  5. int max(int a,int b);
  6. int min(int a,int b);
  7. void main()
  8. {
  9. int a,b,c;
  10. scanf("%d%d%d",&a,&b,&c);
  11. printf("%d",((a+b+c)-max(max(a,b),c)-min(min(a,b),c)));
  12.  
  13. }
  14. int max(int a,int b)
  15. {
  16. if(a>b)
  17. return a;
  18. else
  19. {
  20. return b;
  21. }
  22. }
  23. int min(int a,int b)
  24. {
  25. if(a>b)
  26. return b;
  27. else
  28. {
  29. return a;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement