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 are shell structures used for?
Explain low-order bytes.
Write a program of prime number using recursion.
Is null always defined as 0(zero)?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
code for quick sort?
What type of function is main ()?
Where are some collections of useful code fragments and examples?
Why main is not a keyword in c?
What does int main () mean?
Explain how does flowchart help in writing a program?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
Explain can you assign a different address to an array tag?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }