write a program to swap Two numbers without using temp variable.

Answer Posted / ankit tiwari

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("enter the two number");
scanf("%d%d",&a,&b);
a=b-a;
b=b-a;
a=b+a;
printf("ais=%d",a);
printf("b is=%d",b);
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you please explain the difference between strcpy() and memcpy() function?

805


What is unsigned int in c?

731


main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }

1133


Explain how can you check to see whether a symbol is defined?

859


What is the difference between new and malloc functions?

801


What is wrong in this statement? scanf(“%d”,whatnumber);

961


Is main an identifier in c?

830


What is the difference between declaring a variable and defining a variable?

931


What does *p++ do?

786


Explain how can I prevent another program from modifying part of a file that I am modifying?

851


How to explain the final year project as a fresher please answer with sample project

709


What's the total generic pointer type?

801


Write a program to swap two numbers without using third variable in c?

837


What is data structure in c programming?

786


What are the scope of static variables?

815