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 |
Which built-in library function can be used to match a patter from the string?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
How can type-insensitive macros be created?
Why c language?
sir i got 146 correct question & i have also the advantage of height so will they consider my marks as 146+3=149.can any body tell me how they consider my height marks.
what is the difference between #include<stdio.h> and #include"stdio.h" ?
What is a pointer and how it is initialized?
What's the difference between struct x1 { ... }; and typedef struct { ... } x2; ?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
Write a C Program to display the following menu: Menu 1. Display 2. Copy 3. Append 4. Exit Accept the choice (1-4) from the user, and perform the following tasks: Choice 1: Accept a file name from the user and display the file on screen Choice 2: Accept two file names, and copy first file to the second Choice 3: Accept two file names, and append second file to the first file Choice 4: Terminate the program
1 Answers Accenture, Concor, DMU, Satyam, Syntel, Tora,
What is static memory allocation?
how to copy a string without using c function