Click here to Skip to main content
15,911,141 members
Home / Discussions / C#
   

C#

 
GeneralRe: Encrypt emails and send leaves a copy in drafts folder Pin
Member 1320312316-May-17 3:03
Member 1320312316-May-17 3:03 
QuestionMessage Closed Pin
15-May-17 19:20
Member 1312346615-May-17 19:20 
AnswerRe: PAN card design print application Pin
dan!sh 15-May-17 21:22
professional dan!sh 15-May-17 21:22 
GeneralRe: PAN card design print application Pin
Member 1312346615-May-17 23:30
Member 1312346615-May-17 23:30 
AnswerRe: PAN card design print application Pin
Richard MacCutchan16-May-17 0:00
mveRichard MacCutchan16-May-17 0:00 
GeneralRe: PAN card design print application Pin
Member 1312346618-May-17 19:49
Member 1312346618-May-17 19:49 
GeneralRe: PAN card design print application Pin
Richard MacCutchan18-May-17 21:31
mveRichard MacCutchan18-May-17 21:31 
GeneralRe: PAN card design print application Pin
Member 1312346618-May-17 21:42
Member 1312346618-May-17 21:42 
GeneralRe: PAN card design print application Pin
Richard MacCutchan18-May-17 22:11
mveRichard MacCutchan18-May-17 22:11 
Questionredirect URL ouput to listbox Pin
picasso215-May-17 16:03
picasso215-May-17 16:03 
AnswerRe: redirect URL ouput to listbox Pin
Richard MacCutchan15-May-17 20:47
mveRichard MacCutchan15-May-17 20:47 
QuestionFind highest number using for-loops and arrays Pin
Member 1320204015-May-17 8:35
Member 1320204015-May-17 8:35 
Hi,

I need to create a program to ask the user about 20 integers and find the highest number using for-loops and arrays. The code I've created is not working since it's not giving me the highest number. Can someone please advise me on what to do/change?

//======MY CODE======

int[] tal = new int[20];

for (int i = 0; i < 20; i++)
{
Console.WriteLine("Skriv ett nummer: ");
string strNr = Console.ReadLine();
int nr = Convert.ToInt32(strNr);

tal[i] = nr;

}
int largest = 0;
for (int i = 0; i < tal.Length -1; i++)

{
if (i > largest)
largest = i;
}
Console.WriteLine("Det största talet är: ", largest);
Console.ReadKey();
GeneralRe: Find highest number using for-loops and arrays Pin
harold aptroot15-May-17 9:13
harold aptroot15-May-17 9:13 
AnswerRe: Find highest number using for-loops and arrays Pin
Richard MacCutchan15-May-17 20:46
mveRichard MacCutchan15-May-17 20:46 
QuestionUTC Time Conversion Pin
milo-xml15-May-17 6:32
professionalmilo-xml15-May-17 6:32 
AnswerRe: UTC Time Conversion Pin
Richard MacCutchan15-May-17 7:56
mveRichard MacCutchan15-May-17 7:56 
GeneralRe: UTC Time Conversion Pin
milo-xml15-May-17 8:00
professionalmilo-xml15-May-17 8:00 
AnswerRe: UTC Time Conversion Pin
Richard Deeming15-May-17 7:58
mveRichard Deeming15-May-17 7:58 
GeneralRe: UTC Time Conversion Pin
milo-xml15-May-17 8:04
professionalmilo-xml15-May-17 8:04 
QuestionProblem in deserializing a JSON object in C# Pin
Farhad Eft15-May-17 3:07
Farhad Eft15-May-17 3:07 
AnswerRe: Problem in deserializing a JSON object in C# Pin
Dave Kreskowiak15-May-17 4:24
mveDave Kreskowiak15-May-17 4:24 
AnswerRe: Problem in deserializing a JSON object in C# Pin
Richard MacCutchan15-May-17 5:54
mveRichard MacCutchan15-May-17 5:54 
GeneralRe: Problem in deserializing a JSON object in C# Pin
Richard Deeming15-May-17 7:48
mveRichard Deeming15-May-17 7:48 
GeneralRe: Problem in deserializing a JSON object in C# Pin
Richard MacCutchan15-May-17 7:55
mveRichard MacCutchan15-May-17 7:55 
GeneralRe: Problem in deserializing a JSON object in C# Pin
Richard Deeming15-May-17 7:59
mveRichard Deeming15-May-17 7:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.