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 Implement SHELL SORT
  • C Program to Check the Leap Year
  • C Program to Print PRIME Numbers in a Given Range
  • C Program to Implement Doubly Linked List Operations
  • C Program to Search an Array Element using BINARY SEARCH
  • C Program to Find Area of a Square
  • C Program for String Comparison without using Built in Function
  • C Program to Implement Structure with Pointers
  • C program to Implement BREAK Statement
  • C Program to Print Pascal Traingle
  • C Program to Find Sum of All Array Values
  • C Program to Find Biggest of Two Numbers using Ternary
  • C Program to Find Factorial of a Number using Functions
  • C Program to Find Factorial of a Number using While Loop
  • C Program for Fibonacci Series Using for Loop
  • Privacy Policy
  • Cookie Policy
© programming9.com 2025
Back to top