Advertisement
LeTuanAnh

Tien taxi

Oct 9th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int main(){
  5.     int n;
  6.     printf("\nNhap so km: ");_s("%d",n);
  7.     int tien = 0;
  8.         n -= 1;
  9.         tien += 5000;
  10.         if (n > 0){
  11.                 if (n + 1 >= 5){
  12.                         tien += 4500 * 4;
  13.                         n -= 4;
  14.                 }
  15.                 else{
  16.                         tien += 4500 * n;
  17.                         n = 0;
  18.                 }
  19.         }
  20.         if (n > 0){
  21.                 if (n + 5 >= 6){
  22.                         tien += 3500 * n;
  23.                 }
  24.         }
  25.         if (n >= 120){
  26.                 tien *= 0.9;
  27.         }
  28.     printf("Thanh tien: %d",tien);
  29.     _getch();
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement