No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

max.c 592B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. int print_alarm1() {
  2. int j = 0;
  3. while (j<5) {
  4. printf(255);
  5. stop(7);
  6. printf(0);
  7. stop(7);
  8. j = j+1;
  9. }
  10. }
  11. int print_alarm2() {
  12. int j = 0;
  13. while (j<5) {
  14. printf(170);
  15. stop(7);
  16. printf(85);
  17. stop(7);
  18. j = j+1;
  19. }
  20. }
  21. int get_value() {
  22. print_alarm2();
  23. stop(100);
  24. int i = get();
  25. return i;
  26. }
  27. int max(int * tab, int size) {
  28. int i = 0;
  29. int max = 0;
  30. while (i<size) {
  31. if (tab[i] > max) {
  32. max = tab[i];
  33. }
  34. i = i+1;
  35. }
  36. return max;
  37. }
  38. int main() {
  39. int tab[10];
  40. int i = 0;
  41. while (i<10) {
  42. tab[i] = get_value();
  43. i = i+1;
  44. }
  45. print_alarm1();
  46. printf(max(tab, 10));
  47. }