Search
 
SCRIPT & CODE EXAMPLE
 

C

swapping of two numbers without using third variable in c

#include<stdio.h>
void main()
{
	int x = 10, y = 20;
    printf("Before swap x=%d y=%d",x,y);
    x=x+y;
    y=x-y;
    x=x-y;
    printf("
After swap x=%d y=%d",x,y);
}
Comment

swapping two numbers in c

//Author: Subodh
        //! Swap two number using XOR operation
        cout << "Before, n1 = " << num1 << ", n2 = " << num2 << endl;
        num1 = num1 ^ num2, num2 = num1 ^ num2, num1 = num1 ^ num2;
        cout << "After, n1 = " << num1 << ", n2 = " << num2 << endl;
Comment

c program for swapping of two numbers using temporary variable

#include <stdio.h>
int main()
{
    int a, b, temp;
    printf("enter the values of a and b: 
");
    scanf("%d%d", &a, &b );
    printf("current values are:
 a=%d
 b=%d
", a, b);
    temp=a;
    a=b;
    b=temp;
    printf("After swapping:
 a=%d
 b=%d
", a, b);
}
Comment

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;
}
Comment

c program for swapping of two numbers

// Overcomplicating things lol. Try this
#include <stdio.h>
int main()
{
    int x, y;
    printf("Enter Value of x ");
    scanf("%d", &x);
    printf("
Enter Value of y ");
    scanf("%d", &y);
    int temp = x;
    x = y;
    y = temp;
    printf("
After Swapping: x = %d, y = %d", x, y);
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: c print 
C :: transfer function exponent matlab 
C :: c language float user input 
C :: debian unhold packages 
C :: fseek function in c 
C :: how to transform a char to ascii code in c 
C :: mysql yyyymm format 
C :: lxc Failed to load config for 
C :: how to free memory in c 
C :: c extern 
C :: print in c 
C :: gitlab ci heroku 
C :: virtualbox how to move vmdk to another folder 
C :: Multi-line Comments in C 
C :: logical operators in c 
C :: Example of read and write project in c 
C :: example of source file 
C :: gandhi ashram saharanpur 
C :: count number of items using delimiter 
C :: left me on read 
C :: findtotalcurtain 
C :: print integer to stdout using write or putchar? 
C :: 1 f = c 
C :: online c compiler for graphics 
C :: 25802 WARNING: lib not found: _pywrap_tensorflow_internal.pyd dependency of D:Devtoolsminicondalibsite-packages ensorflowpythonclient\_pywrap_tf_session.pyd 
C :: counting 7s in an integer c 
C :: c language dictionary implemet 
C :: how much larger integer i can input in c language? 
C :: resize vm boot disk with empty space 
C :: take array input from user and calc the avr in c 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =