swap two integer variables without using a third temporary
variable?
Answer Posted / onkar koparde
i'll only give u logic #include<stdio.h>
void main() { int a=10,b=20;
printf("b4 swap:a=%d b=%d",a,b);
a=a+b;b=a-b;a=a-b; printf("aftr
swap:a=%d b=%d",a,b); }
from-onkar.koparde@gmail.com
| Is This Answer Correct ? | 2 Yes | 4 No |
Post New Answer View All Answers
Explain what is the difference between functions abs() and fabs()?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What are dangling pointers? How are dangling pointers different from memory leaks?
What does emoji p mean?
What is the default value of local and global variables in c?
Explain how can I open a file so that other programs can update it at the same time?
How can a process change an environment variable in its caller?
write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values. The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.
Can you define which header file to include at compile time?
What does %2f mean in c?
Which of these functions is safer to use : fgets(), gets()? Why?
What is function and its example?
shorting algorithmS
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
Explain what math functions are available for integers? For floating point?