void calcUnique(long long num) { int unique; //number of different digits in given number int digit long long value; int seen; int count; value = num; seen = 0; unique = 0; count = 0; do { digit = value % 10; if((seen & (1 << digit)) == 0) { ++count; seen = seen | (1 << digit); } value = value / 10; }while(value > 0); printf("Total Unique Digits: %d\n", unique); return; }
unique
count
if
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)