print right digit of integer

#include <iostream>

using namespace std;


int main()

{

    int num;

    cout << "Enter a number : " << endl;

    cin >> num;


    cout << "rightmost digit of the number : " << num % 10 << endl;


    }