Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(){
- int n;
- scanf("%d", &n);
- int prethoden_broj=0;
- int najmala_razlika = 2000000000;
- // prethoden_broj = 5
- //najgolema_razlika = 5
- for(int i = 0; i < n; i++) { // i = 4
- int x;
- scanf("%d", &x);
- if(i > 0) {
- if(najmala_razlika > x - prethoden_broj) {
- najmala_razlika = x - prethoden_broj;
- }
- }
- prethoden_broj = x;
- }
- printf("%d", najmala_razlika);
- return 0;
- }
- /*
- 2
- J J K Q
- A K Q K
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement