Thursday, May 2, 2019

Scanning Int and string by retailer

  • Problem Description

    Haris retail shop he need a software to get the name of the product and cost of the product and generate a bill for that one product which consist of name of the product and cost of that product.
  • Test Case 1

    Input (stdin)
    soap

    121

    Expected Output
    PRODUCT NAME:soap

    COST:121
  • Test Case 2

    Input (stdin)
    Macbook

    150000

    Expected Output
    PRODUCT NAME:Macbook

    COST:150000
Solution

#include <stdio.h>
int main()
{
char ch[12];
  int b;
  scanf ("%s",ch);
  scanf ("%d",&b);
  printf ("PRODUCT NAME:%s",ch);
  printf ("\nCOST:%d",b);
return 0;
}

No comments:

Post a Comment

Parity

Problem Description Ram and Sita playing the parity game. Two types of parity are there. One is odd parity and next is even parity. Ram will...