I've been slowly working at it, the program I'm going to post runs and displays a pontential humble number and and prime number between 11 and the number. Now I need to test them one at a time, using modulus, vs the number and if I get a 0, the number is not hunble. I'm having a tough time with this, any clues?
Code:
#include <stdio.h>
int main (void)
{
int test, num1;
int num;
int humble = 0;
int is_prime = 0;
int prime = 0;
//Start for loop at 2, 1 declared not humble
for (num = 2; num < 23; num++)
//Give numbber inital test
if (num % 2 == 0 || num % 3 == 0 || num % 5 == 0 || num % 7 == 0)
{
//Assign num to num1
for (num1 = 11; num1 < num; num1++)
{
//Start for loop to get all primes between starting at 11
for (test = 2; test < num1; test++)
{
//Test for prime number
is_prime = num1 % test;
//not prime
if (is_prime == 0)
{
//printf ("%d\n", test);
break;
}
}
//If prime
if (test == num1)
{
prime = num1;
printf ("%d is a prime number in between 11 and %d\n", test, num);
}
}
//printf("%d\n", num);
}
}