jeudi 1 juin 2017

Check if two integers has the same "ones digit"

Say we have two values,

int a = 2489;
int b  = 3019201;

From these two values i want to create an if statement to check if the two values have the same ones digit. i.e. 248(9) and 301920(1). In this case they dont obviously.

But i want to make an if to check this, how would i go ahead and do this?

Aucun commentaire:

Enregistrer un commentaire