-
Notifications
You must be signed in to change notification settings - Fork 18
/
Divisibility Test.cs
75 lines (74 loc) · 2.34 KB
/
Divisibility Test.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication181
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter the Maximum Range of the Array:");
int N = Convert.ToInt32(Console.ReadLine());
int[] div = new int[N];
int[] num = new int[N];
int[] quo = new int[N];
int d = 0, n = 0, q = 0;
Console.WriteLine("\n");
Console.WriteLine("Enter the numbers:");
for (n = 0; n < N; n++)
{
num[n] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("\n");
Console.WriteLine("Enter the Divident values:");
for (d = 0; d < N; d++)
{
div[d] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("\n");
for (d = 0; d < N; d++)
{
for (n = 0; n < N; n++)
{
if (d == n)
{
quo[q] = (num[n] / div[d]);
q++;
}
}
}
Console.WriteLine("\n");
Console.WriteLine("The Quotient values are:");
for (q = 0; q < N; q++)
{
Console.Write("{0} ", quo[q]);
}
Console.WriteLine("\n");
Console.WriteLine("d n output");
for (d = 0; d < N; d++)
{
for (n = 0; n < N; n++)
{
for (q = 0; q < N; q++)
{
if ((d == n)&&(n == q)&&(q==d))
{
if ((quo[d] * div[d]) == num[n])
{
Console.WriteLine("{0} {1} truthy", div[d], num[n]);
}
else
{
Console.WriteLine("{0} {1} False ",div[d],num[n]);
}
}
}
}
}
Console.WriteLine("\n");
Console.ReadLine();
}
}
}