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 Number of Characters and Words in a String
  • C Program to Simulate PRIORITY CPU Scheduling Algorithm
  • C Program to ADD two MATRICES
  • C Program to Find Biggest of Two Numbers using Ternary
  • C Program to Implement Single Linked List Operations
  • C Program to Find Prime Factors of a Given Positive Number
  • C Program to Find Sum of Odd Integers
  • C Program to Convert Temperature from Degree Centigrade to Fahrenheit
  • C Program for LINEAR SEARCH
  • Page Replacement Programs in C
  • C Program for Multiplication Table using Goto Statement
  • C Program for String Concatenation without using strcat()
  • C Program to Find Sum of 5 Subjects and Percentage
  • C Program to Solve Tower of Hanoi Problem Using Recursive and Non-Recursive
  • C program to Implement BREAK Statement
  • Privacy Policy
  • Cookie Policy
© programming9.com 2026
Back to top