Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- char tur,zaman;
- int dk;
- float fatura;
- printf("tarife turu(h/b/o):");
- scanf("%c",&tur);
- while ( getchar() != '\n' );
- printf("sabah/gece(s/g):");
- scanf("%c",&zaman);
- while ( getchar() != '\n' );
- printf("kac dakika:");
- scanf("%d",&dk);
- switch(tur)
- {
- case 'h':
- if (zaman == 's') fatura=10+(dk*0.05);
- else
- if (zaman == 'g') fatura=10+dk*0.03;
- else printf("hata");
- break;
- case 'b':
- if (zaman == 's') fatura=12+(dk*0.05);
- else
- if (zaman == 'g') fatura=12+dk*0.03;
- else
- printf("hata");
- break;
- case 'o':
- if (zaman == 's') fatura=14+(dk*0.05);
- else
- if (zaman == 'g') fatura=14+dk*0.03;
- else printf("hata");
- break;
- default: printf("hata");
- }
- printf("fatura=%f\n",fatura);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement