Saturday, August 18, 2018

IO-19

  • Problem Description

    Heera is a cute little gal of age 5 years old, she had one piggybank to save money (coins). Her piggy bank got full and she was excited to her savings money. So, she classified the coins of its followings types , Rs.10 coins, Rs. 5 Coins , Rs .2 Coins, Rs. 1 Coins. Now Please help her to calculate the total amount she saved?

    Input :

    total number of coins collected on every classified type respectively( Rs..10 Coins, Rs. 5 Coins, Rs. 2 coins, Rs.1 Coins)
  • CODING ARENA::
  • #include <stdio.h>
    int main()
    {
      int a, b, c, d, e; 
      scanf("%d %d %d %d %d",&a, &b, &c, &d, &e);
      a=a*10;
      b=b*5;
      c=c*2;
      d=d*1;
      e=a+b+c+d;
      printf("Total amount in the piggybank=%d.00", e); 
    return 0;
    }
  • Test Case 1

    Input (stdin)
    10
    
    23
    
    43
    
    6
    
    
    Expected Output
    Total amount in the piggybank=307.00
  • Test Case 2

    Input (stdin)
    8
    
    33
    
    4
    
    1
    
    
    Expected Output
    Total amount in the piggybank=254.00

No comments:

Post a Comment