Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { int a,b,c,d=0,e=1; scanf("%d", &a); int ara[a]; for(b=0; b<a; b++) scanf("%d", &ara[b]); c=ara[d]; for(d=0; d<a; d++) { if(ara[d]<c) { c=ara[d]; e=d+1; } } printf("%d\n", e); return 0; }
Thank you brother. Nice solution .
ReplyDeleteI used to initialize with 0. In this case why it shows 10% error if initialize e=0 instead of e=1?
ReplyDelete