Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int a[100],i,j,b=0;
- int n;
- scanf("%d",&n);
- for(i=0;i<n;i++)
- {
- scanf("%d",&a[i]);
- }
- for(i=1;i<n;i++)
- {
- for(j=i+1;j<n;j++)
- {
- if(a[i]>a[j])
- {
- b=j+1;
- }
- else
- {
- if(a[i]==a[j])
- {
- b=0;
- }
- }
- }
- if(a[i]==0)
- {
- b=b-1;
- }
- }
- printf("%d\n",b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment