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 should a programmer decide whether to use a macro or a subroutine to accomplish a given logical function
1 Answers R V College of Engineering, University of Jordan,
hai i like to do some certifications in programming or any other......... am doing my IT third year......... pls guide me...... mail me ur suggestions to ranjithmaharaj@gmail.com...
How to print a name "ARCHANA" in any programming language
Why we need new operator in java at the time of object declaration and why not in c++?
Write a shell program. Enter basic pay of an employee and calculate DA, HRA, Deduction, Gross pay and Net pay as follows: DA = 75 % of BASIC HRA = 10 % of BASIC DEDUCTION = 15 % of BASIC GROSS PAY = BASIC+DA+HRA NET PAY = GROSS PAY-DEDUCTION.
what is the use of occurs 10 or (any number) in the internal table declaration with header line.
why we use new keyword for object
Difference between views and index in sas programming
what are the 3 forms of a prolog term
What is the difference between DECISION COVERAGE(DC) and MODIFIED CONDITION/DECISION COVERAGE(MCDC)?
5.Call by value and Call by reference with program?
what is c sharp dotnet