Ahnaf123

CHOCOLATE!!!

Dec 14th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int chocolate_price,my_cash;
  6.  
  7. scanf("%d %d" ,&chocolate_price,&my_cash);
  8.  
  9. if(my_cash>=chocolate_price)
  10. {
  11. printf("you can buy %d\n",my_cash/chocolate_price);
  12. }
  13.  
  14. else
  15. {
  16. int extra=chocolate_price-my_cash;
  17.  
  18. printf("Sorry!You need more %d BDT",extra);
  19. }
  20. return 0;
  21. }
  22.  
  23.  
  24. input
  25. 100 40
  26. or
  27. 40 100
  28. Ans
  29. Sorry!You need more 60 BDT
  30. or
  31. you can buy 2
Add Comment
Please, Sign In to add comment