Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int i,s1,s2,cost,flag;
  5. int price[5]={13,12,9,14,15};
  6. s1=price[0];
  7. s2=price[1];
  8. for (i=2;i<5;i++)
  9. {
  10. if(s1>price[i]&&s2>price[i])
  11. {
  12. s1=s2;
  13. s2=price[i];
  14. }
  15. if(s2>price[i])
  16. s2=price[i];
  17. }
  18. cost=s1+s2;
  19. printf("%d",cost);
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement