1
0
UAHCode/CPE221/DataTypes2_02b.cpp

32 lines
786 B
C++
Raw Permalink Normal View History

2022-08-28 21:12:16 +00:00
//
// ***** Program Ch03_2b.cpp ***********
// Example of arithmetic operations, increment and decrement
// operators
#include <iostream>
using namespace std;
int main()
{
cout << "Integer division\n\n";
cout << "10/2: " << 10/2 << endl;
cout << "10/3: " << 10/3 << endl;
cout << "10/4: " << 10/4 << endl;
cout << "10/6: " << 10/6 << endl;
cout << "\nModulus operation\n";
// Modulus operation examples. These examples show the
// result of the modulos operation on various integer division values.
cout << "10 mod 2: " << 10%2 << endl;
cout << "10 mod 3: " << 10%3 << endl;
cout << "10 mod 4: " << 10%4 << endl;
cout << "10 mod 6: " << 10%6 << endl;
cout << "*******************************\n";
//cout << "10.5 mod 6.5: " << 10.5%6.5 << endl;
return 0;
}