C PROGRAMME TO SWAP/INTERCHANGE TWO GIVEN NUMBERS

Discuss your AMIE related anything quaries.....
Post Reply
RAVIGARU
Adviser
Adviser
Posts: 313
Joined: Sat May 05, 2012 9:47 pm
Contact:

C PROGRAMME TO SWAP/INTERCHANGE TWO GIVEN NUMBERS

Post by RAVIGARU »

C PROGRAMME TO SWAP/INTERCHANGE TWO GIVEN NUMBERS
THIS IS A VERY IMPORTANT C PROGRAMME

Code: Select all

    
    #include<stdio.h>
    #include<conio.h>
    main()
   {
   int x, y, temp;
 
   printf("Enter the value of x and y\n");
   scanf("%d%d", &x, &y);
 
   printf("Before Swapping\nx = %d\ny = %d\n",x,y);
 
   temp = x;
   x = y;
   y = temp;
 
   printf("After Swapping\nx = %d\ny = %d\n",x,y);
   getch();
  }


OUTPUT Screen shot is

Swap.jpg
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “GENERAL DISCUSSION”