Advertisement
bilasi

Untitled

Apr 21st, 2014
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. /*maximum*/
  2. #include<stdio.h>
  3. int main()
  4. {
  5. int a[100], i, max = 0;
  6. for(i = 0; i<3; i++){
  7. scanf("%d", &a[i]);
  8. }
  9. max = a[0];
  10. for(i = 0; i<3; i++){
  11. if (max<a[i])
  12. max = a[i];
  13. }
  14. printf("Max: %d", max);
  15.  
  16. return 0;
  17. }
  18. /*minimum */
  19. #include<stdio.h>
  20. int main()
  21. {
  22. int a[100], i, min = 0;
  23. for(i = 0; i<3; i++){
  24. scanf("%d", &a[i]);
  25. }
  26. min = a[0];
  27. for(i = 0; i<3; i++){
  28. if (min>a[i])
  29. min = a[i];
  30. }
  31. printf("Min: %d", min);
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement