Saturday, August 18, 2018

BOTTLE DEPOSIT

  • Problem Description

    In many jurisdictions a small deposit is added to drink containers to encourage people to recycle them. In one particular jurisdiction, drink containers holding one litre or less have a 0.10 deposit, and drink containers holding more than one litre have a
    0.25 deposit.

    Write a program that reads the number of containers of each size from the user. Your program should continue by computing and displaying the refund that will be received for returning those containers. Format the output so that it includes a rupees
    and always displays exactly two decimal places.
  • CODING ARENA::
  • #include <stdio.h>
    int main()
    {
      int a,b;
      float c;
      scanf("%d%d",&a,&b);
      c=a*0.10+b*0.25;
      printf("Refund for Bottles=%.2f",c);

    return 0;
    }
  • Test Case 1

    Input (stdin)
    23
    
    22
    
    
    Expected Output
    Refund for Bottles=7.80
  • Test Case 2

    Input (stdin)
    157
    
    198
    
    
    Expected Output
    Refund for Bottles=65.20

No comments:

Post a Comment