swap two number wthout using third variable
Answers were Sorted based on User's Feedback
Answer / jvhariharan
void main()
{
int a=10,b=20;
a=a+b;
b=a-b;
a=a-b;
}
Is This Answer Correct ? | 24 Yes | 3 No |
Answer / ashutosh tiwari
void swap_num(int *a, int *b)
{
*a = *a+*b; *b = *a-*b; *a = *a-*b;
}
or
void swap_num(int *a,int *b)
{
*a = *a^*b; *b = *a^*b; *a = *a^*b;
}
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / suyog
A very simple and cute answer...
Assign as follows
a=a+b-(b=a)
Is This Answer Correct ? | 6 Yes | 0 No |
Answer / abhay khare
void main()
{
int a,b,c
printf("two no are\n");
scanf("%d&n");
a=c;
b=a
c=b
getch;
}
Is This Answer Correct ? | 1 Yes | 10 No |
how many keywords are present in "c"?
18 Answers Assurgent, Cynosure Software, IBM,
what is dynamic polymorphism?
a characteristic of a multiprogramming is? a.simultaneous exe of pgm instr 4m 2 appli b.concurrent processing of 2 r more prgms c.multiple cpu s d.all the abov
i want to open a helkp file that is txt file on link buttons click
what is delegats ?
What is the requirement in MIMD ?
What is meant byStatic Variable ?
what is the difference between an application and service??? i mean service which runs as in services.msc.
9.Difference between even and odd signals?explain with the diagram?
How to update a data for the views in the relational data base schema
how CLR identify vb file?
3. . Explain the Cache memory? What is the advantage of a processor having more cache memory?