C++ Program for Basic Programs

Master C++ with Real-time Projects and Kickstart Your Career Start Now!!

Program 1

// Swaping using third variables
#include<iostream>
#define clrscr() system("cls")
using namespace std;

int main()
{
    int a,b,c;
    clrscr();
    cout<<"\nEnter two number";
    cin>>a>>b;
    cout<<"\nBefore swaping "<<a <<" "<<b;
     c=a;
     a=b;
     b=c;
     cout<<"\nAfter swaping "<<a <<" "<<b;
    return 0;
}

Program 2

// Swaping using third variables
#include<iostream>
#define clrscr() system("cls")
using namespace std;

int main()
{
    int a,b,c;
    clrscr();
    cout<<"\nEnter two number";
    cin>>a>>b;
    cout<<"\nBefore swaping "<<a <<" "<<b;
     c=a;
     a=b;
     b=c;
     cout<<"\nAfter swaping "<<a <<" "<<b;
    return 0;
}

Program 3

// Arithmatic operation between to numbers
#include<iostream>
#define clrscr() system("cls")
using namespace std;

int main()
{
    int a,b;
    clrscr();
    cout<<"\nEnter two number";
    cin>>a>>b;
    cout<<"\nAddition is :"<<a+b;
    cout<<"\nSubtraction is :"<<a-b;
    cout<<"\nMultiplication :"<<a*b;
    cout<<"\nDivision is :"<<a/b;
    return 0;
}

 

Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *