Computer Science, asked by ajomon4093, 1 year ago

Swap the values of two numbers in c programming using function

Answers

Answered by aalaparunp66okp
0

#include<iostream.h>

#include<conio.h>

void switch(int a , int b)

{

          int temp;

          temp=a;

          a=b;

          b=a;

}

void main()

{

          clrscr();

          int a,b;

          cout<<"Enter two numbers : "

          cin>>a>>b;

          switch(a,b);

          cout<<"\n The swapped values : \n"

          cout<<" A = "<<a<<'\n';

          cout<<" B = "<<b<<'\n';

          getch();

}

Similar questions