Saturday, August 18, 2018

COMPUTING X

  • Problem Description

    The cost prince of n articles is the same as the selling price of X articles . If the profit is p% then what is the value of x?

    Input format:

    The first input is an integer which corresponds to n the second is an integer which corresponds to p

    Output Formt:

    Refer sample Input and output for formatting Specifications

    The float values are displayed correct to 2 decimal places.
  • CODING ARENA
  • #include<stdio.h>
    int main()
    {
      float cp,sp,x;
      scanf("%f%f",&cp,&sp);
      x=(cp*100)/(sp+100);
      printf("%.2f",x);
        
    return 0;
    }
  • Test Case 1

    Input (stdin)
    12.5
    
    14.5
    
    
    Expected Output
    10.92
  • Test Case 2

    Input (stdin)
    5.0
    
    6.0
    
    
    Expected Output
    4.72

No comments:

Post a Comment