Canna

Saturday, 15 June 2019

Pointer 3

  • Problem Description

    Write a program to subtract two double values using pointer

    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
  • Test Case 1

    Input (stdin)
    4
    
    5
    
    
    Expected Output
    -1.00
  • Test Case 2

    Input (stdin)
    10
    
    6
    
    
    Expected Output
    4.00
  • Program
  • #include <stdio.h>
    int main()
    {
      float a,b,c;
      scanf("%f%f",&a,&b);
      c=a-b;
      printf("%f",c);
      
     return 0;
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.