Swapping

thareefahamed_s · September 23, 2020 · C
#include <stdio.h>

int main() {
    printf("#S_W_A_P_P_I_N_G EXAMPLE#\n");
    printf("..........................\n");
    int first_no,second_no;
    printf("Enter the value for first number:");
    scanf("%d",&first_no);
    printf("%d\n",first_no);
    printf("Enter the value for second number:");
    scanf("%d",&second_no);
    printf("%d\n",second_no);
    printf("_____________________________________");
    printf("##AFTER SWAPPING##\n");
    printf("********************");
    first_no=first_no+second_no;
    second_no=first_no-second_no;
    first_no=first_no-second_no;
    printf("First number after swapping is %d\n",first_no);
    printf("Second number after swapping is %d\n",second_no);
    printf("---------------------------------------");
    return 0;
}

Comments

Please sign up or log in to contribute to the discussion.