For Loop- primeCheck
Submissions: 7480   Accuracy:

31.37%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Fork CPP

What do you do when you need to execute certain statements more than once? You put them in a loop. Loops are very powerful. Majority of coding questions need loops to work. You can't even input testcases without loops!

Here, we will use for loop and check if the given number n is prime or not.
Note: A number is prime if it's divisible by itself and 1. Also, 1 is not prime.

Input Format:
First line of input conatins number of testcases T. For each testcase, there will be one line of input containing a number n.

Output Format:
For each testcase, print "Yes" if n is prime, else print "No".

User Task:
Your task is to complete the provided function.

Constraints:
1 <= T <= 10
1 <= a <= 1000

Input:
2
1
2

Output:
No
Yes

** For More Input/Output Examples Use 'Expected Output' option **

Author: Soul_xhacker


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.