adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

C++ program to perform basic arithmetic operations of two numbers.

Program in C++ to calculate addition, subtraction, multiplication, division and modulus division



PROGRAM CODE
#include<iostream>
#include<conio.h>
 using namespace std;
  class Number
   {
    private:
       int a,b;
    public:
      void input()
       {
         cout<<"Input two number:-";
         cin>>a>>b;
       }
     void Addition()
       {
        int s=a+b;
         cout<<"\nAddition = "<<s;
       }
     void Subtraction()
      {
        int s=a-b;
         cout<<"\nSubtraction = "<<s;
      }
     void Multiplication()
      {
        int s=a*b;
         cout<<"\nMultiplication = "<<s;
      }
       void Division()
      {
        int s=a/b;
         cout<<"\nDivision = "<<s;
      }
      void Modulus()
      {
        int s=a%b;
         cout<<"\nModulus = "<<s;
      }
    };
  int main()
   {
     Number n1;
     n1.input();
     n1.Modulus(); 
     n1.Addition();
     n1.Division();
     n1.Subtraction();
  n1.Multiplication();    
     getch();
   }
Output:-









Post a Comment

0 Comments