i need a help in the for loop statment

i need to write a program that prompts the user to enter the value x , the program should print message to show whether the x is prime number or not useing for loop

A Prime Number can be divided evenly only by 1 or itself.

For example 5 is prime number because

5%2!=0

5%3!=0

5%4!=0

And 7 is prime because

7%2!=0

7%3!=0

7%5!=0

7%6!=0

But 6 is not prime because

6%2=0 and 6%3=0

Sample1 : Please Enter value: 4

4 is not prime

Sample2 : Please Enter value: 7

7 is prime

there are a hint tells that you may need to use the idea of flags (Boolean variable)
and i dont want to use the function
so i dont know how to solve it !!!!

if you can help me i will be so grateful for you :)
you must have some idea?
Topic archived. No new replies allowed.