simple math program.

I am trying to write a simple program that takes a start and end number and determines the largest number in that range that CANNOT be obtained using the numbers 9 and 8. I think I may possibly have it, but I'm not sure if it works out right.

1
2
3
4
5
6
7
8
9
10
11
  max =0;
  for (int num = start; num <= end; num++)
	{
		n = num / 9;
		for (int i = 0; i <= n; i++)
		{
			balance = num - (i * 9);
			if ((balance % 8) == 0) break;
			max = num;
		}
	}
Topic archived. No new replies allowed.