Posted By

ozkriff on 09/16/08


Tagged


Versions (?)

hw3


 / Published in: C
 

  1. #include <stdio.h>
  2. int main()
  3. {
  4. int min, mp, zp=999, i, m[5]={15,0,-12,0,66};
  5.  
  6. for (i=0;i<5;i++)
  7. printf("%d ",m[i]);
  8.  
  9. for (i=0;i<5;i++)
  10. if (m[i]==0)
  11. {
  12. zp=i;
  13. break;
  14. }
  15. if (zp!=999)
  16. printf("\nzero pos is %d",zp);
  17. else
  18. printf("\nno m[i]==0");
  19. min=m[0];
  20. for (i=0;i<5;i++)
  21. {
  22. if (min>m[i])
  23. {
  24. min=m[i];
  25. mp=i;
  26. }
  27. }
  28. printf("\nmin is %d",min);
  29. printf("\nmin pos is %d",mp);
  30.  
  31. if (zp>mp)
  32. printf("\nmp is smaller");
  33. else
  34. printf("\nzp is smaller");
  35. return 0;
  36. }

Report this snippet  

You need to login to post a comment.