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
    Type 2 or more characters for results.

    C Program for Swapping of Two Numbers Without Using Third Variable

    Written by: sk.shahida
    • Basic C Programs-3
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        int a,b;
        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 Calculate NCR
    • C Program to Find Biggest of Two Numbers using Ternary
    • C Program to Find Sum of Even Integers
    • C Program to Print Pyramid of Numbers
    • C Program to Find Second Largest Number in an Array
    • Binary Search Program in C using Recursive and Non-Recursive Methods
    • C Program to Print Prime Numbers upto a given Number
    • C Program to Evaluate POSTFIX Expression Using Stack
    • C Program to Find Biggest among Three Numbers
    • C Program for Swapping of Two Numbers Without Using Third Variable
    • C Program to Perform Arithmetic Operations Using Switch
    • Implementation of Queue using Array in C
    • C Program to Calculate Sum of Even Values in an Array
    • C program for Fibonacci Series using do-while Loop
    • C Program to Check Whether a Number is PALINDROME or Not
    • Privacy Policy
    • Cookie Policy
    © programming9.com 2025
    Back to top