Subtracting Two Numbers - C++ Operator

C++ examples for Operator:Arithmetic Operator

Description

Subtracting Two Numbers

Demo Code

#include <iostream> 
using namespace std; 
  
int main(int argc, const char * argv[]) 
{ 
        cout << "Enter your first number: " << endl; 
        float number1 = 0.0f; 
        cin >> number1; /*from  www . j  a v a2 s.co m*/
  
        cout << "Enter your second number: " << endl; 
        float number2 = 0.0f; 
        cin >> number2; 

        float result = number1 - number2; 
        cout << "The result of subtracting your two numbers is: " << result << endl; 
        return 0; 
}

Result


Related Tutorials