Advertisement
Tahamina_Taha

Swap Numbers Using Temporary Variable

Aug 17th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include<stdio.h>
  2. void main()
  3. // Swap Numbers Using Temporary Variable
  4. {
  5.  
  6.     double a,b,temp;
  7.     printf("Enter first number:\n");
  8.     scanf("%lf",&a);
  9.     printf("Enter second number:\n");
  10.     scanf("%lf",&b);
  11.     temp=a;
  12.     a=b;
  13.     b=temp;
  14.     printf("After swapping, first Number: %.0lf\n",a);
  15.     printf("After swapping, second Number: %.0lf",b);
  16.  
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement