-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay_25.cs
35 lines (28 loc) · 865 Bytes
/
Day_25.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static bool isPrime( int no ){
if( no == 1 )
return false;
if( no == 2 )
return true;
int noSqrt =(int)Math.Floor(Math.Sqrt(no));
for( int i=2; i<=noSqrt; i++){
if( no%i == 0 )
return false;
}
return true;
}
static void Main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
int t = int.Parse(Console.ReadLine());
while( t-->0){
int no = int.Parse(Console.ReadLine());
if( isPrime(no) )
Console.WriteLine("Prime");
else
Console.WriteLine("Not prime");
}
}
}