-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask9.cs
More file actions
35 lines (22 loc) · 727 Bytes
/
task9.cs
File metadata and controls
35 lines (22 loc) · 727 Bytes
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;
namespace functions_and_methods
{
class Program
{
public static void Main(string[] args) {
int n, i, m = 0, flag = 0;
Console.Write("Enter the number to check Prime");
n = int.Parse(Console.ReadLine());
m=n/2;
for(i = 2; i <= m; i++) {
if(n % i == 0) {
Console.Write("Number is not Prime");
flag = 1;
break;
}
}
if(flag == 0)
Console.Write("Number is Prime.");
}
}
}