Q: Write a program to swap the values of two variables.
Solution:
Screenshot:
Solution:
#include <iostream> using namespace std; int main(int argc, char *argv[]) { int a,b,temp; cout<<"\nEnter two numbers : "; cin>>a>>b; temp=a; a=b; b=temp; cout<<"\nAfter swapping numbers are : "; cout<<a<<" "<<b; return 0; }
Screenshot:
No comments:
Post a Comment