SUMMER TRAINING Free Tutorials  Go To Your University  Placement Preparation 
Project Based Best Summer Training Courses in Jaipur
Join our Telegram Channel To take free Online Courses
0 like 0 dislike
564 views

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.1k points)
edited by
 
Best answer

Exchange of Two Numbers Using Function

In this program we are going to implement exchange of two numbers using function in C programming.

To learn basics of function in C programming Click Here.

Example :

#include<stdio.h>
#include<conio.h>

//Declaration of exchange function
void exchange(int x,int y);

void main()
{
int x,y;
clrscr();

//Taking two numbers from user
printf("\nEnter two numbers:");
scanf("%d%d",&x,&y);
printf("\nBefore Exchange x = %d and y = %d",x,y);

//calling exchange function
exchange(x,y);
getch();
}
//Definition of exchange function
void exchange(int x,int y)
{
int z;
z=x;
x=y;
y=z;
printf("\nAfter Exchange x = %d and y = %d",x,y);
}

Output :

Output of above program showing swapping of numbers


For More GTU C Programming Lab Experiments Click Here

Our Mentors(For AI-ML)


Sharda Godara Chaudhary

Mrs. Sharda Godara Chaudhary

An alumna of MNIT-Jaipur and ACCENTURE, Pune

NISHA (IIT BHU)

Ms. Nisha

An alumna of IIT-BHU

Related questions

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 
...