when you enter a,b,c,d,e numbers by keyword

COUNTING
A. Sum of numbers
B. Multiply numbers
C. Greatest number
D. descending of numbers

PRINTING ON SCREEN
A- Sum of numbers
B- Sum of multiplication
C- The greatest number
D- descenging of numbers

``````using System;
class Program
{
static void Main(string[] args)
{
int[] value = new int[5];
int sum = 0, multip = 1;
string tpl="",crp="";
for (int i = 0; i < 5; i++)
{
Console.Write("\n" + (char)(i + 5) + ":");

if (i != 4)
{ tpl += sum.ToString() + "+"; crp += value.ToString() + "*"; }
else
{ tpl += value.ToString(); crp += value.ToString(); }

}
Console.Clear();
Console.Write(tpl + "=" + sum.ToString() + "\n");
Console.Write(crp + "=" + multip.ToString());
Array.Sort(value);
Console.Write("\n Greatest number=" + value[4].ToString() + "\n");
for (int i = 0; i < 5; i++)
Console.Write(value.ToString() + " ");
}
}``````

i wrote this but it did not work.
i use sharp developer and the codes must be compiles by csharp developer.

this should be a command prompt application.

any help is appreciated. i need it urgently.
due day is tomorrow.

thanks

1. If you want to do any operations on array of values it does must have some values so fill array with values:

``int[] value = new int[5] { 5, 1, 2, 4, 3 };``

you can also give the user the possibility to specify the values:

``````int[] value = new int[5];
for (int i = 0; i < 5; i++)
{
Console.WriteLine("Specify number " + (i + 1).ToString() + ": ");
}``````

but remember that conversion from string to int is not always possible so you should put it in the try catch block (if you're already familiar with errors handling)...
2. using

``arrayName[index]``

syntax you get the value form array!

You're code after corrections... I did not added any sophisticated code trying to make it easier for you...

``````int[] value = new int[5] { 5, 1, 2, 4, 3 };
/*
int[] value = new int[5];
for (int i = 0; i < 5; i++)
{
Console.WriteLine("Specify number " + (i + 1).ToString() + ": ");
}
*/

int sum = 0, multip = 1;
string tpl= "", crp= "";
for (int i = 0; i < 5; i++)
{
sum += value[i];
multip *= value[i];
if (i != 4)
{
tpl += value[i].ToString() + " + ";
crp += value[i].ToString() + " * ";
}
else
{
tpl += value[i].ToString();
crp += value[i].ToString();
}
}

Console.Clear();
Console.Write(tpl + " = " + sum.ToString() + "\n");
Console.Write(crp + " = " + multip.ToString());
Array.Sort(value);
Console.Write("\nGreatest number = " + value[4].ToString() + "\n");
for (int i = 0; i < 5; i++)
Console.Write(value[i].ToString() + " ");