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 Copy a String with out using strcpy() Built in Function
  • C Program for Monthly Bill of a Newspaper
  • C Program to Delete Characters from Given String
  • C Program to Find String Length with out using Function
  • C Program to Print a Message using Functions
  • C Program to Compare Two Strings using strcmp()
  • Simulate Bankers Algorithm for Deadlock Avoidance Using C
  • Compute Factorial of Large Numbers using C
  • C Program to Print ASCII values of Characters
  • C Program to Convert Infix to Postfix Expression using Stack
  • C Program for Call By Reference
  • C Program to Find Area of Rectangle
  • C Program to Find Simple Interest
  • C Program to Search an Array Element using BINARY SEARCH
  • C Program for Sum of Digits of a Number
  • Privacy Policy
  • Cookie Policy
© programming9.com 2026
Back to top