asiffff

uri

Dec 20th, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a[100],i,j,b=0;
  5. int n;
  6. scanf("%d",&n);
  7. for(i=0;i<n;i++)
  8. {
  9. scanf("%d",&a[i]);
  10.  
  11. }
  12. for(i=1;i<n;i++)
  13. {
  14. for(j=i+1;j<n;j++)
  15. {
  16. if(a[i]>a[j])
  17. {
  18. b=j+1;
  19.  
  20. }
  21. else
  22. {
  23. if(a[i]==a[j])
  24. {
  25. b=0;
  26.  
  27. }
  28.  
  29. }
  30. }
  31. if(a[i]==0)
  32. {
  33. b=b-1;
  34. }
  35.  
  36. }
  37. printf("%d\n",b);
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment