Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. float contanti=500,carta=2000,spesa=0;
  6. while((contanti+carta)>0)
  7. {
  8. printf("Soldi su carta=%0.2f\nSoldi in contanti=%0.2f\nTotale=%0.2f\nInserire Spesa: ",carta,contanti,carta+contanti);
  9. scanf("%f",&spesa);
  10. if(spesa>=500 || contanti<=0)
  11. carta-=spesa;
  12. else
  13. if(contanti-spesa<0)
  14. {
  15. printf("Contanti non sufficienti, prelevamento dalla carta\n");
  16. contanti-=spesa;
  17. carta+=contanti;
  18. contanti=0;
  19. }
  20. else
  21. contanti-=spesa;
  22. }
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement