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

Swap Two Static Numbers Using C

Written by: G.Lakshmi Prasanna
  • Basic C Programs-3
#include<stdio.h>
#include<conio.h>
void main()
{
    int a=7,b=5;
    printf("Actual values : \n a=%d \t b=%d",a,b);
    a=a*b;
    b=a/b;
    a=a/b;
    printf("\n After Swapping : \n a=%d \t b=%d",a,b);   
}

 OUTPUT:

Actual values :
 a=7     b=5
 After Swapping :
 a=5     b=7

 

You can see an another method of writing the code with out using third variable.

Previous article: FCFS CPU Scheduling Algorithm Simulation Using C Prev Next article: C Program for Swapping of Two Numbers Without Using Third Variable Next
  • C Program for String Concatenation without using strcat()
  • C program for Fibonacci Series using do-while Loop
  • C Program for Floyd Triangle
  • C Program to Implement Structure with Functions
  • C Program to Design Lexical Analyzer
  • C Program to Find Sub String Position in Given String
  • C Program to Find Radius and Circumference of a Circle
  • C Program to Calculate Sum of Marks to Demonstrate Structures
  • C Program to Implement Circular Linked List
  • C Program to convert Celsius to Fahrenheit
  • C Program to Find Prime Factors of a Given Positive Number
  • C Program to find Reverse of a Number
  • C Program to ADD two MATRICES
  • Swap Two Static Numbers Using C
  • C Program to Implement STACK Operations Using Pointers
  • Privacy Policy
  • Cookie Policy
© programming9.com 2026
Back to top