Example 3: C++ program to perform the arithmetic operations
kw.cpp
#include<iostream>usingnamespacestd;intmain(){inta=0,b=1;cout<<"———————————————————————————————————————————";cout<<"\nProgram for the arithmetic operations ";cout<<"\n———————————————————————————————————————————";cout<<"\nValue of a | "<<a;cout<<"\nValue of b | "<<b;cout<<"\nValue of "<<a<<" / "<<b<<" | "<<(a/b);cout<<"\nValue of "<<a<<" + "<<b<<" | "<<(a+b);cout<<"\nValue of "<<a<<" - "<<b<<" | "<<(a-b);cout<<"\nValue of "<<a<<" * "<<b<<" | "<<(a*b);cout<<"\nValue of "<<a<<" % "<<b<<" | "<<(a%b);cout<<"\nValue of a++ | "<<a++;cout<<"\nValue of ++a | "<<++a;cout<<"\n———————————————————————————————————————————\n";return0;}
Output
kodingwindow@kw:~$ g++ kw.cpp kodingwindow@kw:~$ ./a.out
———————————————————————————————————————————
Program for the arithmetic operations
———————————————————————————————————————————
Value of a | 0
Value of b | 1
Value of 0 / 1 | 0
Value of 0 + 1 | 1
Value of 0 - 1 | -1
Value of 0 * 1 | 0
Value of 0 % 1 | 0
Value of a++ | 0
Value of ++a | 2
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.