I have to find factors of 1-10 then count all factors and find if they are odd/even. I know how to find if they are even or odd i just can't count how many factors for each number.

#include <iostream.h>
#include <stdlib.h>

int main()
{
int num, icntA, icntB, icntC, sub = 0.0;
int total = 0.0;
cout << "Please enter a positive maxiumum integer value you wish to find divisors: \n";
cin >> num;


for(icntA = 1; icntA <= num; icntA++)
{
for(icntB = 1; icntB <= num; icntB++)
{
if(icntA % icntB == 0)
cout << icntB << " " ;

}

sub = ( icntB/icntB);
total = total + sub;
cout << endl;
}

cout << "total of open: "<< total << endl;
system("pause");
return 0;
}

thank you for any help

so
1: 1(odd)
2: 1,2(total of factors = 2)(even)
3: 1,3(even)
4: 1,2,4(odd)
5: 1,5(even)
6: 1,2,3,6(even)
7: 1,7(even)
8: 1,2,4,8(even)
9: 1,3,9(odd)
10: 1,2,5,10(even)
but the "total" only thing I need is total but it keeps displaying every factor for every number.
total of odds = 3

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.