write a program to swap two variables a=5 , b= 10 without
using third variable
Answer Posted / nagendra kumar
#include<stdio.h>
main(){
int a,b;
printf("Enter A value: ");
scanf("%d",&a);
printf("\nEnter B value: ");
scanf("%d",&b);
printf("\nThe value of A is:%d",a);
printf("\n The value of B is:%d",b);
a=a+b;
b=a-b;
a=a-b;
printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}
| Is This Answer Correct ? | 20 Yes | 4 No |
Post New Answer View All Answers
What do you mean by a local block?
In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]
Can we declare variable anywhere in c?
How is null defined in c?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
Give differences between - new and malloc() , delete and free() ?
What is a MAC Address?
Define VARIABLE?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
What is 02d in c?
I came across some code that puts a (void) cast before each call to printf. Why?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
how to write optimum code to divide a 50 digit number with a 25 digit number??
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
What is the purpose of void pointer?