Advertisement
Guest User

kod

a guest
Oct 27th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3.  
  4. {
  5.  
  6. char tur,zaman;
  7. int dk;
  8. float fatura;
  9.  
  10. printf("tarife turu(h/b/o):");
  11. scanf("%c",&tur);
  12. while ( getchar() != '\n' );
  13.  
  14. printf("sabah/gece(s/g):");
  15. scanf("%c",&zaman);
  16. while ( getchar() != '\n' );
  17.  
  18. printf("kac dakika:");
  19. scanf("%d",&dk);
  20.  
  21. switch(tur)
  22. {
  23. case 'h':
  24. if (zaman == 's') fatura=10+(dk*0.05);
  25. else
  26. if (zaman == 'g') fatura=10+dk*0.03;
  27. else printf("hata");
  28. break;
  29.  
  30. case 'b':
  31. if (zaman == 's') fatura=12+(dk*0.05);
  32. else
  33. if (zaman == 'g') fatura=12+dk*0.03;
  34. else
  35. printf("hata");
  36. break;
  37.  
  38. case 'o':
  39. if (zaman == 's') fatura=14+(dk*0.05);
  40. else
  41. if (zaman == 'g') fatura=14+dk*0.03;
  42. else printf("hata");
  43. break;
  44.  
  45. default: printf("hata");
  46.  
  47. }
  48.  
  49. printf("fatura=%f\n",fatura);
  50.  
  51. return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement