| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| C-Sharp Programming Post questions, answers, and comments about C#. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Do While Loops
Hi everyone,
Before i start i've gotta admit i'm new when it comes to coding. For our college work we've gotta create a programme that lets a user input some numbers until 0 is entered. Upon entering 0 the programme then spits out how many of the numbers put in are even and how many are odd. Now we've been told we've gotta use the modulus division and a do while loop, but i've got completely stuck and have no idea what to do. Cheers for any help, Regards, Weems316. |
|
#2
|
|||
|
|||
|
Re: Do While Loops
The modulus requirement doesn't make sense going with the information that you have provided, but the do while loop is pretty simple:
Code:
do
{
// grab input
} (while input != "0")
|
|
#3
|
|||
|
|||
|
Re: Do While Loops
The modulus operator can be used to tell you whether a number is even or odd. I'll leave it as an excercise to the reader [0] to figure out exactly how to do it.
[0] heh heh heh, i feel like a lecturer now I always wanted to say that!
__________________
www.monotorrent.com For all your .NET bittorrent needs NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|