Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- float roadLength = 0;
- float taxy = 0;
- float taxyStart = 0.70;
- float price = 0;
- char dayOrNight[12];
- char test[12] = "edno";
- scanf("%f", &roadLength);
- scanf("%s", dayOrNight);
- if (strcmp(dayOrNight, "day") == 0) {
- taxy = 0.79;
- }
- else
- {
- taxy = 0.90;
- }
- if (roadLength <20)
- {
- price = taxyStart +taxy * roadLength;
- }
- if (roadLength >=20 && roadLength < 100) {
- float bus = 0.09;
- price = bus * roadLength;
- }
- if (roadLength >=100) {
- float train = 0.06;
- price = train * roadLength;
- }
- printf("%f", price);
- return(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement