# Need help with a beginner program in X

#### icyaria

Hello, I'm new to programming so I have a question about a program I'm trying to make in C. I'm supposed to make a program that prints 1) the number of numbers from 0 to MAXNUM that satisfy condition A, 2) the number of numbers from the same space that satisfy condition B and also 3) print all numbers that satisfy both conditions
I was able to do 1) and 2) but have no idea how to approach the 3d question and if anyone has any suggestions or can help me even by the smallest hint for how to approach this I'd really appreciate it!

#### flajko

Hello.

Can you post how the code you made for 1 and 2?

#### icyaria

i don't know if it makes sense but this was what I was asked to do and now i need to find how many and also print all the numbers that are both one-child and abundant

C:
``````#include <stdio.h>
#define MINNUM 0
#define MAXNUM 1000

int main()
{
int n, j, i, tempn, ndigits, subseq, pow10, count, oc, divisor, sum, count2;
count2 = 0;
oc = 0;
for (n = 1 ; n <= MAXNUM ; n++){
sum = 1 ;
for (divisor=2; divisor * divisor < n; divisor++) {
if(n%divisor==0){
sum += divisor + n / divisor;
}
}
if (divisor * divisor == n) {
sum += divisor;
}
if (sum >  n) {
count2++;
}
}
for (n = MINNUM ; n <= MAXNUM ; n++){

tempn = n;
ndigits = 0;
while (tempn != 0){
ndigits++;
tempn /= 10;
}
pow10 = 1;
count = 0;
for (j=1; j<= ndigits; j++) {
pow10 *= 10;
tempn = n;
for (i=1; i<=ndigits -j+1; i++){
subseq = tempn % pow10;
if (subseq % ndigits == 0) {
count++;
if (count == 1) {oc++; }
if (count == 2) {oc--; }
}
tempn /= 10;
}
}
}
printf("Found %d abundant numbers\nFound %d only-child numbers \n",count2, oc);
}``````