Make a program that allows you to find the number of digits that a number will have, which will be supplied by the user, it will have between (1 to 5) digits, and the program must also indicate if the number of digits of this number corresponds to an even number. or odd
#include <iostream> using namespace std; int main() { int num, digits = 0; cout<<"Enter a number: "; cin>>num; if(num < 0) { num *= -1; } while(num > 0) { digits++; num /= 10; } cout<<"Total digits: "<<digits<<endl; if((digits % 2) == 0) { cout<<"Even number of digits."<<endl; } else { cout<<"Odd number of digits."<<endl; } return 0; }