Advertisement
Josif_tepe

Untitled

Nov 15th, 2022
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5. int n;
  6. scanf("%d", &n);
  7.  
  8. int prethoden_broj=0;
  9. int najgolema_razlika = -2000000000;
  10. // prethoden_broj = 5
  11. //najgolema_razlika = 5
  12. for(int i = 0; i < n; i++) { // i = 4
  13. int x;
  14. scanf("%d", &x);
  15. if(i > 0) {
  16. if(najgolema_razlika < x - prethoden_broj) {
  17. najgolema_razlika = x - prethoden_broj;
  18. }
  19. }
  20. prethoden_broj = x;
  21. }
  22. printf("%d", najgolema_razlika);
  23.  
  24. return 0;
  25.  
  26. }
  27.  
  28. /*
  29. 2
  30. J J K Q
  31. A K Q K
  32.  
  33. **/
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement