Click to See Complete Forum and Search --> : console application help
KatieHo
October 12th, 2009, 04:46 PM
Hi everyone! I am new here and I am new in C# (started to learn it his year at Uni). I hope you won't mind to help me with my homework. I got the console application to do. the task says
"Write a program to output the numbers 1 to 20 inclusive, excluding the numbers 5 and 18". I did it, but it shows all the numbers starting from 1 till 20, and I can't think how to make it right. Please help! Thank you!
BigEd781
October 12th, 2009, 05:08 PM
So, we don't usually do homework for people here, but it seems to me that you would simply check for the numbers '5' and '18' and not print them...
KatieHo
October 12th, 2009, 05:23 PM
hi thanx for reply. All i need just a hint how to do it as i stuck. the program should output (as i understand it) numbers in a row 1-till 20 excluding 5 and 18.
BigEd781
October 12th, 2009, 05:29 PM
ok, so...
for ( int i = 1; i < 21; ++i )
{
if ( i != 5 && i != 18 )
{
Console.WriteLine( i );
}
}
KatieHo
October 12th, 2009, 05:33 PM
aaaaaaaa!! Thank you!! (grrr! so easy!)
i study it 1st month as i am 1st year student. Sorry to bother you. I will try to find some other forum for the beginners. Thanx again!
BigEd781
October 12th, 2009, 05:36 PM
It's ok, you don't have to find another forum. We are glad to help students with their homework, we just prefer not to hand them an answer. Next time, just post some code which shows what you have already tried, tell us what the problem is, and we will help you think through it.
KatieHo
October 12th, 2009, 05:43 PM
Thanx mate! I'm really appriciated!! I was thinking since yesterday, and now it is so easy so i think how could I not do it??!!
Thanks a lot!
Mutant_Fruit
October 12th, 2009, 06:18 PM
We are glad to help students with their homework, we just prefer not to hand them an answer.
But you did just hand them the answer ;) As this is the first month of learning how to program, they really should be checking their notes for this kind of stuff. It's far too early to start getting handed the answers online, they might get lazy! ;)
KatieHo
October 12th, 2009, 06:24 PM
hehe I promise i won't ask for answers anymore and I will work hard :D
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.