New to our community ?

Discover a world of possibilities! Join us and explore a vibrant community where ideas flourish and connections thrive.

One of Our Valued Members

Thank you for being part of our community. Your presence enriches our shared experiences. Let's continue this journey together!

Home Technical swap two numbers without using a temporary variable …

swap two numbers without using a temporary variable …

0

C Program to swap two numbers without using third variable with programming examples for beginners and professionals covering concepts, control statements, c array, c pointers, c structures, union, c strings and more.

swap.c

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\n enter the value of a and b :");
scanf("%d %d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("swapping of a=%d",a);
printf("swapping of b=%d",b);
getch();
}