Hey guys! I am new to C++ and I have an assignment coming up that I can't seem to nail down. Actually, I am very lost and would like some help.
We were told to write a program that will first, prompt the user to input a positive integer (check).
Then, store that integer in a variable called initial_num (check)
-------?---------L?--------O?------S?-----T?-----------?
Use loops and if statements (or switch statements) in order to output every positive integer (num) from one to intital_num.
then, test each num to see if it is prime or not. (in doing so, output the numbers that evenly divide the num)
---------> I can't get past this part to get to the next part----------->
after outputting these numbers, send out a message stating whether or not num is prime.
your code should execute as shown below:
Testing 1 >
1
1 is not a prime number
Testing 2 >
1 2
2 is a prime number
3..
..
4..
..
..
..
7
Press any key to continue...
_______sample run 2_______
Testing 1 >
1
1 is not a prime number
Testing 2 >
1 2
2 is a prime number
3..
..
4..
..
..
..
testing 7 >
1 7
7 is a prime number
8
9
10
11
12 >
1 2 3 4 6 12
12 is not a prime number
Press any key to continue.....
Seems pretty basic. Also, any youtube beginner links or any resource you can throw my way to help me learn this language would be much appreciated!