I'm working on homework for C programming class, and I can't figure this out. Question: "Write a program that obtains a number n from the user and prints the first n prime numbers, with one number printed per line"
So far we have learned for, if, while statements...
I have a for loop to calculate the nth prime numbers. But I'm not sure if "i<=n" should be the condition. Because if "i<=n", then when you want n=5 prime numbers, you won't get 5 numbers. underneath it is an if statement to determine if the number is prime or not. Then I was trying to figure out to display them, if using an IF statement would work.
please help, thanks
printf("Enter value for n: ");