Regina is incharge of the annual day committee. The annual day committee decides to conduct a lucky draw for the audience. As the crowd is huge, it is very hard to include the whole audience in the lucky draw. Therefore, management decides to conduct lucky draw only for the audience who have occupied the chair number which is prime. Regina and other committee members find it difficult to check which chair numbers are prime. Can you help them to find out whether the chair number is prime or not?
Prime number is a number which can be divided only by 1 and itself.
Input Format:
The input consist of an integer which denotes the chair number
Output Format:
If chair number is prime, print "Eligible". Otherwise, print "Not eligible".
Sample Input:
3
Sample Output:
Eligible
Answers
Answered by
0
Answer:
yes ..i ll
2 ,3, 5, 7, 11 , 13 ,17, 19 , 23, 29 ,31 , 37 , 41 , 43 , 47 ,53 , 59 , 61 , 67 , 71 , 73 , 79 , 83 , 89 , 91
and by the way I just gave up to 100 it would be better to inform how many seats of audience did they arrange
Answered by
1
Answer:
#include <iostream>
using namespace std;
int main()
{
int num, i, j = 0;
cin >> num;
for (i = 1; i <= num; i++)
{
if ((num % i) == 0)
{
j++;
}
}
switch(j)
{
case 2:
cout<<"Eligible";
break;
default:
cout<<"Not eligible";
break;
}
}
Similar questions