PROGRAM-7


//Program for swapping two numbers by call by value
#include
#include
void swap(int, int);
void main()
{
 clrscr();                                                                                       
 int x, y;
 printf("Enter the value of x");
 scanf("%d", &x);
 printf("Enter the value of y");
 scanf("%d", &y);
 swap(x,y);
 getch();
}
 void swap(int x, int y)
{
 int temp;
 temp=x;
 x=y;
 y=temp;
 printf("The values after swapping are x=%d   y=%d", x,y);
}


Algorithm

·                     Start
·                     Declare x, y as integer
·                      Write(“the value of x")
·                      Read(“the value of x”)
·                      Write("the value of y")
·                      Read("the value of  y”)
·                      swap(x,y) (call function)
·                      stop
·                      void swap(int x, int y) (read function)
·                     Declare temp as integer
·                      temp=x
·                      x=y
·                      y=temp
·                      Read("The value of x and y after swaping”)


#vpsinghrajput

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 comments:

Post a Comment