bsc

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

root / semester_1 / tuition-c / P019.c

P019.c (693B)


      1 /* WAP to input the distance covered and calculate
      2 the amount to be paid by the passanger.
      3     Distance        Rate
      4     =<5KM           RS 90
      5     next 10KM       RS 20/KM
      6     next 10KM       RS 10/KM
      7     more than 25KM  RS 9/KM
      8 */
      9 
     10 #include <stdio.h>
     11 int main()
     12 {
     13     double dis, amt;
     14     printf("Enter the distance : ");
     15     scanf("%lf", &dis);
     16     if (dis <= 5.0)
     17         amt = 90.0;
     18     else if (dis > 5.0 && dis <= 15.0)
     19         amt = 90.0 + (dis - 5.0) * 20;
     20     else if (dis > 15.0 && dis <= 25.0)
     21         amt = 90.0 + 200.0 + (dis - 15.0) * 10;
     22     else if (dis > 25.0)
     23         amt = 90.0 + 200.0 + 100.0 + (dis - 25.0) * 9;
     24     printf("\nAmount to be paid : %g", amt);
     25     return 0;
     26 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror