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);

printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is union and structure?

577


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

608


How can you allocate arrays or structures bigger than 64K?

687


What is action and transformation in spark?

600


How do you determine a file’s attributes?

605






formula to convert 2500mmh2o into m3/hr

501


What are the advantages of using macro in c language?

596


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2338


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2177


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

652


Give me the code of in-order recursive and non-recursive.

890


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

1659


What are the advantages of using new operator as compared to the function malloc ()?

760


code for quick sort?

1626


Explain how can I read and write comma-delimited text?

661