Answers for "how to swap 2 variables in c without using a 3rd"

C
0

swapping of two numbers in c without temporary variable

#include<stdio.h>  
void main()    
{    
int a=10, b=20;      
printf("Before swap a=%d b=%d",a,b);      
a=a+b;   
b=a-b;   
a=a-b;   
printf("\nAfter swap a=%d b=%d",a,b);      
}
Posted by: Guest on April-05-2022
0

C Programming to swap two variables

#include <stdio.h>

int main()
{
    int x = 20, y = 30, temp;
    temp = x;
    x = y;
    y = temp;
    printf("X = %d and Y = %d", x, y);
    
    return 0;
}
Posted by: Guest on June-28-2021

Code answers related to "how to swap 2 variables in c without using a 3rd"

Code answers related to "C"

Browse Popular Code Answers by Language