Problem Description
Write a program to swap two numbers and print the swapped number in float.Test Case 1
Input (stdin)10 78
Expected Output78.00 10.00
Test Case 2
Input (stdin)104 239
Expected Output239.00 104.00Program
#include <stdio.h> int main() { int x,y,temp; int *a,*b; scanf("%d %d",&x,&y); a=&x; b=&y; temp=*a; *a=*b; *b=temp; printf("%.2f\n%.2f",(float)*a,(float)*b); return 0; }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.