a C prog to swap 2 no.s without using variables just an
array?
Answers were Sorted based on User's Feedback
Answer / laxmi bose
#include<stdio.h>
main()
{
int a[0],a[1],a[2];
scanf("%d%d",&a[0],&a[1]);
a[2]=a[0];
a[0]=a[1];
a[1]=a[2];
printf("%d,%d",a[0],a[1]);
}
| Is This Answer Correct ? | 11 Yes | 0 No |
Answer / sankar kiran
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("Enter the number:");
scanf("%d%d",&a,&b)
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
getch();
}
| Is This Answer Correct ? | 14 Yes | 7 No |
Answer / jaspreet singh
void main()
{
int a[2]={20,10};
a[0]=a[0]^a[1];
a[1]=a[0]^a[1];
a[0]=a[0]^a[1];
printf("a=%d,b=%d",a[0],a[1])
getch();
}
| Is This Answer Correct ? | 7 Yes | 4 No |
Answer / karthik
void main()
{
int a=10,b=20;
a^=b^=a^=b;
printf("a=%d,b=%d",a,b)
getch();
}
| Is This Answer Correct ? | 8 Yes | 6 No |
Answer / baidyanath bisoyi
void main()
{
int a,b;
printf("enter the two numbers\n");
scanf("%d%d",&a,&b);
printf("a=%d\n b=%d\n",a,b);
a=a+b-(b=a);
printf("a=%d\n b=%d\n",a,b);
getch();
}
| Is This Answer Correct ? | 4 Yes | 3 No |
What is the output of printf("%d", printf("Hello"));?
Why do some versions of toupper act strangely if given an upper-case letter?
how can i make a program with this kind of output.. Enter a number: 5 0 01 012 0123 01234 012345 01234 0123 012 01 0
What is function prototype in c language?
what is the significance of static storage class specifier?
Explain how can you be sure that a program follows the ansi c standard?
what are the advantages & disadvantages of unions?
4.A function 'q' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as: A)int (*q(char*)) [] B)int *q(char*) [] C)int(*q)(char*) [] D)None of the Above
How many keywords (reserve words) are in c?
How is = symbol different from == symbol in c programming?
Why calloc is better than malloc?
what is the basis for selection of arrays or pointers as data structure in a program