Advertisement
TheWhiteFang

[C++][5] Basic arithmetic with remainders etc etc

Oct 6th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream> //pre-processor directive
  2.  
  3. using namespace std; //std library
  4.  
  5. int main() //it starts with the main 1st
  6. {
  7.     int x = 8 * 4;
  8.     int y = 21 % 7; // %-gives remainder of division
  9.     int z = 22 * (4 + 2) + 8 / 2 ; // brackets gets done first obv.
  10.     cout << x <<endl;
  11.     cout << y <<endl;
  12.     cout << z;
  13.     return 0; //to tell that program ran fine
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement