Saturday, August 18, 2018

IO 35


  • Problem Description

    Write a program to display a grocery bill of the product purchased in the small market by Vijay. Get the following details from Vijay:

    Get the product name
    Get the price of the product(Price per Unit)
    Get the quantity of the product purchased
    Input and Output Format:

    Refer sample input and output for formatting specification.

    All float values are displayed correct to 2 decimal places.

    All text in bold corresponds to input and the rest corresponds to output
  • CODING ARENA
  • #include <stdio.h>
  • int main()
  • {
  •   char ch[500];
  •   float f,p;
  •   int u;
  •   scanf("%s",ch);
  •   scanf("%f",&f);
  •   scanf("%d",&u);
  •   printf("Product Details\n");
  •   printf("%s\n",ch);
  •   printf("%.2f\n",f);
  •   printf("%d\n",u);
  •   p=f*u;
  •   printf("Bill:%.2f",p);
  •   return 0;
  • }

  • Test Case 1

  • Input (stdin)
    soap
    
    33.00
    
    2
    
    
    Expected Output
    Product Details
    
    soap
    
    33.00
    
    2
    
    Bill:66.00
  • Test Case 2

    Input (stdin)
    chocolate
    
    11.11
    
    5
    
    
    Expected Output
    Product Details
    
    chocolate
    
    11.11
    
    5
    
    Bill:55.55

2 comments: