Swap of two no’s without using third variable.

 


#include <stdio.h>


int main()

{

    int num1,num2;

    printf("enter the value of num1 and num2 ");

    scanf("%d %d",&num1,&num2);

    num1=num1+num2;

    num2=num1-num2;

    num1=num1-num2;

    printf("swap value of num1 is %d\n",num1);

    printf("swap value of num2 is %d",num2);


    return 0;

 }


No comments:

Post a Comment

Programming in C Language

  PROGRAM LIST TO BECOME PRO IN C    😍😍😍            PRACTICE SETS                                                        UNIT -1  👇   IN...