using System;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
int[] intArray = { 12, 2, 33, 5, 51, 6 };
for (int i = 0; i < 2; i++) {
for (int j=0;j<intArray.Length-i-1;j++) {
if (intArray[j] > intArray[j+1]) {
int temp=intArray[j+1];
intArray[j+1]=intArray[j];
intArray[j]=temp;
}
}
}
//foreach (int i in intArray) {
// Console.Write(i+" ");
//}
Console.WriteLine(intArray[intArray.Length-2]);
}
}
}
using System;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
int[] intArray = { 12, 72, 33, 5, 51, 6,65 };
int max1=0,max2=0;
for (int i = 0; i < intArray.Length; i++) {
if (intArray[i] > max1)
{
max2 = max1;
max1 = intArray[i];
}
else
{
if (intArray[i] > max2)
{
max2 = intArray[i];
}
}
}
Console.WriteLine(max2);
}
}
}
using System;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
string str = "asarsat";
char t=' ';
for(int i=0; i<str.Length; i++)
{
int count = 1;
for (int j = 0; j < str.Length; j++)
{
if (i!=j)
{
if (str[i] == str[j])
{
count++;
break;
}
}
}
if (count == 1)
{
Console.WriteLine(str[i]);
break;
}
}
Console.WriteLine(t);
}
}
}
using System;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
string str = "aaet";
char t=' ';
for(int i=0; i<str.Length; i++)
{
bool count = true;
for (int j = 0; j < str.Length; j++)
{
if (str[i] == str[j] && i != j)
{
count = false;
break;
}
}
if (count)
{
t= str[i];
break;
}
}
Console.WriteLine(t);
}
}
}
using System;
namespace ConsoleApp3
{
internal class Program
{
static void Main(string[] args)
{
string str = "eaaet";
char t=' ';
for(int i=0; i<str.Length; i++)
{
int count = 1;
for (int j = 0; j < str.Length; j++)
{
if (str[i] == str[j] && i != j)
{
count++;
break;
}
}
if (count==1)
{
t= str[i];
break;
}
}
Console.WriteLine(t);
}
}
}