bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

P019.c (829B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* WAP to input the distance covered and calculate
      8 the amount to be paid by the passanger.
      9     Distance        Rate
     10     =<5KM           RS 90
     11     next 10KM       RS 20/KM
     12     next 10KM       RS 10/KM
     13     more than 25KM  RS 9/KM
     14 */
     15 
     16 #include <stdio.h>
     17 int main()
     18 {
     19     double dis, amt;
     20     printf("Enter the distance : ");
     21     scanf("%lf", &dis);
     22     if (dis <= 5.0)
     23         amt = 90.0;
     24     else if (dis > 5.0 && dis <= 15.0)
     25         amt = 90.0 + (dis - 5.0) * 20;
     26     else if (dis > 15.0 && dis <= 25.0)
     27         amt = 90.0 + 200.0 + (dis - 15.0) * 10;
     28     else if (dis > 25.0)
     29         amt = 90.0 + 200.0 + 100.0 + (dis - 25.0) * 9;
     30     printf("\nAmount to be paid : %g", amt);
     31     return 0;
     32 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror