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
What are linked lists in c?
What is a node in c?
Explain what is page thrashing?
Write a code of a general series where the next element is the sum of last k terms.
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
What is the difference between array_name and &array_name?
What is the purpose of type declarations?
What are identifiers and keywords in c?
How can I manipulate strings of multibyte characters?
What is preprocessor with example?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What are qualifiers and modifiers c?
What is scope rule in c?
What is size of union in c?
What is the size of structure in c?