Hi,
In the code below, why is my Else statement not printing?
.
Alos how can i fid the largest element of any array ?
static void Main()
{
int[] firstarray = new[] { 1, 2, 3, 4, 5, 6, 7, 9 };
for (int i = 0; i <= firstarray.Length-1; i++)
{
for (int j = 1; j>=firstarray.Length-1; j++)
{
if (firstarray[i]>firstarray[j])
{
Console.WriteLine(i);
}
else if (firstarray[i] < firstarray[j])
{
Console.WriteLine(j);
}
}
}
}
Manav PandyaPosted Feb 12, 2018, 5:24 AM
Mangesh GPosted Feb 12, 2018, 4:39 AM
harish reddyPosted Feb 12, 2018, 4:34 AM
Suraj KumarPosted Feb 12, 2018, 3:29 AM
harish reddyPosted Feb 12, 2018, 2:43 AM
Manav PandyaPosted Feb 12, 2018, 2:42 AM
Suraj KumarPosted Feb 12, 2018, 2:21 AM