Wednesday, May 20, 2020

Arithmetic operators in C++

  • Program :

#include <iostream>
using namespace std;

int main() {
  cout <<"\n----------------ARITHMETIC OPERATORS----------------\n";
  int x = 10;
  int y = 5;
  int a = 6;
  ++a;
  int b = 6;
  --b;
  cout <<"\n----------------ADDITION----------------\n";
  cout << x + y;
  cout <<"\n----------------SUBTRACTION----------------\n";
  cout << x - y;
  cout <<"\n----------------MULITIPLICATION----------------\n";
  cout << x * y;
  cout <<"\n----------------DIVISION----------------\n";
  cout << x / y;
  cout <<"\n----------------MODULUS----------------\n";
  cout << x % y;
  cout <<"\n----------------INCREMENT----------------\n";
  cout << a;
  cout <<"\n----------------DECREMENT----------------\n";
  cout << b;
  return 0;
}




  • Output :


No comments:

Post a Comment

Function Overloading in C++

https://monitechvenkat1620.blogspot.com Program : #include <iostream> using namespace std; int c(int x, int y) {   return...