write a program to interchange the values of two variables without using third variable using arithmetic operators
Answers
Answered by
10
Answer:
include<stdio.h>
int main()
{
int a, b;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b); //consider two numbers as 4 and 5
a = a + b; //a = 4 + 5 = 9
b = a - b; //b = 9 - 5 = 4
a = a - b; //a = 9 - 4 = 5
printf("Numbers after swapping: %d %d", a, b);
}
Output
Input- Enter two numbers: 4 5 Output- Numbers after swapping: 5 4
Answered by
1
Answer:
class one
{
public static void main
Similar questions