Source Code:
#include<stdio.h>
#include<stdlib.h>
void main(int argc, char const*argv[])
{
int oddCount = 0,
evenCount = 0, InputNum, temp ;
InputNum = atoi(argv[1]);
while (InputNum>
0)
{
temp =
InputNum % 10; /*
separate Last digit from number */
if (temp
% 2 == 1)
{
oddCount++;
}
else
{
evenCount++;
}
InputNum /= 10;
/* remove Last digit from num */
}
printf("Number of Odd digits : %d \nNumber of Even
digits: %d\n", oddCount, evenCount);
}
Output:
Thanks and regards,
Tech Bird
Comments