Powered By Blogger

Feb 11, 2025

8. Swapping Two Numbers (Without Temp Variable)

 #include <stdio.h>

int main() {

    int a, b;

    printf("Enter two numbers: ");

    scanf("%d %d", &a, &b);

    a = a + b;

    b = a - b;

    a = a - b;

    printf("After swapping: a = %d, b = %d\n", a, b);

    return 0;

}


No comments:

Post a Comment

Featured Post

Data Analysis

    What is data analysis and its significance?   Data analysis is the process of collecting, transforming, and organizing data to dr...

Popular Posts