Header Ads Widget

C++ program to subtract two numbers given by user

 

 C++ program to subtract two numbers given by user

Given two numbers , write a program to subtract two numbers given by user .

Sample input:-

5 
4

Sample output:-

1

 C++ program to subtract two numbers given by user

The objective of code is to find the subtraction of two numbers given by user .

Code(C++):-

#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,sub;
    cin>>a>>b;
    sub=a-b;
    cout<<sub<<endl;
}

Output:-

5
4
1




Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-