write a program to swap Two numbers without using temp variable.
Answer Posted / harisharumalla
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("\n Enter the 2 numbers");
scanf("%d%d",&a,&b);
//swaping of 2 numbers without using temp variable
a=a+b;
b=a-b;
a=a-b;
/* or
a=a*b;
b=a/b;
a=a/b;
*/
printf("\n A = %d \n B = %d\n");
getch();
}
| Is This Answer Correct ? | 604 Yes | 119 No |
Post New Answer View All Answers
Explain what are the different file extensions involved when programming in c?
What is a file descriptor in c?
How many types of operator or there in c?
Is main an identifier in c?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
Which programming language is best for getting job 2020?
Why c is called a middle level language?
Is boolean a datatype in c?
What does a function declared as pascal do differently?
What are different storage class specifiers in c?
How can I write a function that takes a format string and a variable number of arguments?
I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
Define and explain about ! Operator?
how should functions be apportioned among source files?