<>

Statement Problem

People park their car outside a shopping mall and pay car stand rent. For 2 hours , the rent is 10 $. After 2 hours, the rate will be 20 $. Write a program that calculates the total bill of a car.
Sample Output:
Enter Total Hours = 6
Your Total Bill = $100
#include <stdio.h>
#include <conio.h>
void main()
{
   int hours=0;
   int bill=0;

   printf("Enter Total Hours = ");
   scanf("%d",&hours);

   if(hours<=2)
   {
      bill=10;
      printf("Your Total Bill = $%d",bill);
   }
   else
   { 
      bill=(2*10)+((hours-2)*20);
      printf("Your Total Bill = $%d",bill);
   }

   getch();
}
Rate this posting:
{[['']]}

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

 
TOP