Guest User

Untitled

a guest
Dec 8th, 2019
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int main(void)
  3. {
  4. int num = 0;
  5. printf("enter numbers\n");
  6. scanf("%d" , &num);
  7. int maximum = num;
  8. int max = num;
  9. int cnt = 0;
  10. while(num != -999)
  11. {
  12. scanf("%d" , num);
  13. if(num>max)
  14. {
  15. if(num>=maximum)
  16. {
  17. max = maximum;
  18. maximum = num;
  19. }
  20. else
  21. {
  22. max = num;
  23. }
  24. }
  25. cnt = cnt+1;
  26. }
  27. if(cnt>1)
  28. {
  29. printf("the highest number is: %d\n" , maximum);
  30. printf("the second highest number is: %d\b" , max);
  31. }
  32.  
  33.  
  34.  
  35.  
  36. return (0);
  37. }
RAW Paste Data