Home
About Us
Contact Us
Privacy Policy
Home
Programs
_C Programs
_C++ Programs
_Python Programs
Operations on Data
_Searching
Projects
_Python
About Us
Contact Us
Privacy Policy
Home
C Program
C Program To Swap Two Numbers
C Program To Swap Two Numbers
Coding PLEX
January 06, 2022
PROGRAM :
main.c
#include
<stdio.h>
int
main
()
{
int
a
,
b
,
temp
;
printf
(
"Enter the value of A
\n
"
);
scanf
(
"%d"
,&
a
);
printf
(
"Enter the value of B
\n
"
);
scanf
(
"%d"
,&
b
);
printf
(
"
\n
Before swapping
\n
A = %d
\n
B = %d
\n
"
,
a
,
b
);
temp
=
a
;
a
=
b
;
b
=
temp
;
printf
(
"
\n
After swapping
\n
A = %d
\n
B = %d
\n
"
,
a
,
b
);
}
#include
int main() { int a,b,temp; printf("Enter the value of A\n"); scanf("%d",&a); printf("Enter the value of B\n"); scanf("%d",&b); printf("\nBefore swapping\nA = %d\nB = %d \n",a,b); temp = a; a = b; b = temp; printf("\nAfter swapping\nA = %d\nB = %d \n",a,b); }
Copy
OUTPUT :
Enter the value of A
2
Enter the Value of B
3
Before swapping
A = 2
B = 3
After swapping
A = 3
B = 2
Post a Comment
0 Comments
Featured Post
QR Code Generator
QR Code Generator Application in Python Using Kivy Module - Beginner's Python Project For Students
Coding PLEX
January 21, 2022
Here is the Complete Code For the QR Code Generator Application in Python Using Kivy …
Popular Posts
Social Plugin
Labels
C Program
18
Python Program
11
Projects
8
Python Turtle Arts
5
C++ Program
3
Games
1
0 Comments