Write a program to interchange two variables without using
the third variable?

Answer Posted / genius

#include <stdio.h>
#include <conio.h>
main()
{
int a,b,temp;
clrscr();
printf("enter two numbers:");
scanf("%d,%d",&a,&b);
printf("values of a and b are %d,%d \n",a,b);
temp=a;
a=b;
b=temp;
printf("swapped values of a and b are %d,%d", a,b);
getch();
}

Is This Answer Correct ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The difference between printf and fprintf is ?

714


What is substring in c?

634


What does != Mean in c?

582


What are near, far and huge pointers?

642


Write a program to print fibonacci series without using recursion?

599






Write a C program to count the number of email on text

1412


Is there anything like an ifdef for typedefs?

696


A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

1770


What is the difference between array and structure in c?

565


Explain what are header files and explain what are its uses in c programming?

623


Write a program to show the change in position of a cursor using c

575


What is nested structure with example?

618


What is far pointer in c?

805


There seem to be a few missing operators ..

614


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); }

910