-
Notifications
You must be signed in to change notification settings - Fork 7
/
Class1.cs
48 lines (44 loc) · 1.05 KB
/
Class1.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
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace For_D
{
public class Class1
{
public double GetFractional(double num)
{
int a = Convert.ToInt32(Math.Floor(num));
return (num - a);
}
public double GetAbsoluteValue(double d)
{
return Math.Round(d);
}
public bool IsPrime(int num)
{
for (int i = 2; i < num; i++)
{
if (num % i == 0)
{
return true;
}
}
return false;
}
public bool IsEven(int num)
{
if (num % 2 == 0) {
return true;
}
return false;
}
}
}
/*4. Create a class library. Library should contain functions to fine
1. Get absolute value
2. Get Factorial
3. Check whether number is prime
4. Check integer is odd or even.
*/