Saturday, September 7, 2019

C program to Swap two numbers without using third variable

#include <stdio.h>
main()
{
int n1,n2;
printf("enter the no.1\n");
scanf("%d",&n1);
printf("enter the no.2\n");
scanf("%d",&n2);
n1=n1+n2;
n2=n1-n2;
n1=n1-n2;
printf("after swaping no.1 is %d\n",n1);
printf("after swaping no.2 is %d",n2);
}



No comments:

Implement stsStr Leetcode solution

  28.   Implement strStr() Easy Implement  strStr() . Given two strings  needle  and  haystack , return the index of the first occurrence of...