programming9
  • Flowcharts
  • Programs
      • Back
      • C Programs
      • C++ Programs
      • Java Programs
      • Python Codes
      • HTML Codes
      • Java Script Codes
      • SQL Codes
  • Tutorials
      • Back
      • Java Tutorials
      • Competitive Programming
      • Python Tutorials
      • C Programming
  • Blog
  • Login

C Program for Swapping of Two Numbers Without Using Third Variable

Details
Written by: sk.shahida
Category: C Programs
  • Basic C Programs-3
#include<stdio.h>
#include<conio.h>
int main()
{
    int a,b;
    clrscr();
    printf("Enter the Values for a & b to Swap: ");
    scanf("%d %d",&a,&b);
    a=a+b;
    b=a-b;
    a=a-b;
    printf("After Swapping the Values of a & b are :%d %d",a,b);
    return 0;
}

 OUTPUT:

Enter the Values for a & b to Swap: 10 20
After Swapping the Values of a & b are :20 10
Previous article: Swap Two Static Numbers Using C Prev Next article: C Program to Find Sum of 5 Subjects and Percentage Next
  • C Program to Find Area of Rectangle
  • C Program to Find Factorial of a Number using Functions
  • C Program to Implement RADIX SORT
  • C Program to Find Sum of 5 Subjects and Percentage
  • C Program for String Comparison without using Built in Function
  • Page Replacement Programs in C
  • C Program to Print PRIME Numbers in a Given Range
  • C Program to Implement Structure with Array
  • Bit Stuffing Program in C
  • Swapping of Two Numbers Using Call By Reference in C
  • C Program to Find Sub String Position in Given String
  • C Program for Circumference of a Circle
  • C Program to Perform Arithmetic Operations Using Switch
  • C Program to Print Hello World
  • C Program to Check the Leap Year
  • Privacy Policy
  • Cookie Policy
© programming9.com 2025
Back to top