The program is a simple one designed to check the numbers between 2 and 9 to see if they are prime. The algorithm that is used is a bit simplistic and does its work using the brute force method, but it looks like it should work. So what really happens?
1 /************************************************
2 * prime -- A very dump program to check to see *
3 * if the numbers 2-9 are prime. *
4 ************************************************/
5 #include <iostream>
6
7 int main()
8 {
9 int i; // Number we are checking
10
11 for (i = 2; i < 10; ++i) {
12 switch(i) {
13 case 2:
14 case 3:
15 case 5:
16 case 7:
17 std::cout << i << " is prime\n";
18 break;
19 default:
20 std::cout << i <<
21 " is not prime\n";
22 break;
23 }
24 }
25 return (0);
26 }