-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathBiggest Number of Same Number.cs
50 lines (48 loc) · 1.37 KB
/
Biggest Number of Same Number.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication71
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Biggest Number of Same Number:");
int N, i,max=0,j;
Console.WriteLine("Enter the Maximum Digits of the Number:");
N = Convert.ToInt32(Console.ReadLine());
int[] a = new int[N];
Console.WriteLine("Enter the Number:");
for (i = 0; i < N; i++)
{
a[i] = Convert.ToInt32(Console.ReadLine());
}
Console.WriteLine("The Values entered are:");
for (i = 0; i < N; i++)
{
Console.Write("{0} ", a[i]);
}
Console.WriteLine("\n");
for (i = 0; i < N; i++)
{
for (j = 0; j < N - 1; j++)
{
if (a[j] < a[j + 1])
{
max = a[j];
a[j] = a[j + 1];
a[j + 1] = max;
}
}
}
for (i = 0; i < N; i++)
{
Console.Write("{0} ", a[i]);
}
Console.WriteLine("\n");
Console.ReadLine();
}
}
}