Canna

Saturday, 15 June 2019

Swap

  • Problem Description

    Write a program to swap two numbers and print the swapped number in float.
  • Test Case 1

    Input (stdin)
    10 78
    
    
    Expected Output
    78.00
    
    10.00
  • Test Case 2

    Input (stdin)
    104 239
    
    
    Expected Output
    239.00
    
    104.00
  • Program
  • #include <stdio.h>
    int main()
    {
    int a,b,t;
      
      scanf("%d %d",&a,&b);
      t=a;
      a=b;
      b=t;
      printf("%.2f\n%.2f",1.0*a,1.0*b);
      
     return 0;
    }

No comments:

Post a Comment

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