The simplest thing is to use the Sieve of Eratosthenes: make an array using the positive integers as the index up to 100.
Starting with 2, store 2 in your list of primes, and and then delete the variable for each multiple of 2 (4, 6, 8, etc.) Then find the smallest index that still exists (3); add 3 to your list of primes, and delete the variable for each multiple of 3 (6, 9, 12, etc.). Then find the next smallest index that still exists (5) and repeat the process over and over. When you reach 100, you're done. (There are many optimizations for this)
Chat with our AI personalities
Here they are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97