google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program to interchange the values of two variables without using a third variable - 2nd puc computer science

Write a program to interchange the values of two variables without using a third variable

// Write a program to interchange the values of two variables without using a third variable

#include<iostream.h> #include<conio.h> void main( ) { int a, b; clrscr( ); cout<<"Enter the two numbers:\n"; cin>>a>>b; cout<<"Before Interchanging : a ="<<a<<" and b = "<<b<<endl; a = a + b ; b = a - b ; a = a - b ; cout<<"After Interchanging : a ="<<a<<" and b = "<<b<<endl; getch(); }

Write a program to interchange the values of two variables without using a third variable Write a program to interchange the values of two variables without using a third variable Reviewed by Vision Academy on February 20, 2022 Rating: 5

No comments:

CheckOut

Powered by Blogger.