write a program in C to swap two variables
Answer Posted / muzammil
#include <stdio.h>
#include <conio.h>
main()
{
int a,b;
printf("Enter the values: ");
scanf("%d%d",&a,&b);
printf("The values before swapping: %d %d",a,b);
a=a-(b=(-b+(a=a+b)));
printf("The values after swapping are: %d %d",a,b);
getch();
}
| Is This Answer Correct ? | 14 Yes | 3 No |
Post New Answer View All Answers
Explain what are the __date__ and __time__ preprocessor commands?
What are the types of type specifiers?
How can I do graphics in c?
Can static variables be declared in a header file?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
What is wrong with this code?
What is the condition that is applied with ?: Operator?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
What is auto keyword in c?
When do we get logical errors?
Why we use void main in c?
Give basis knowledge of web designing ...
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Can main () be called recursively?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?