Need help again... llooping

mr06

Member
Joined
May 1, 2006
Messages
12
Programming Experience
Beginner
Hey there,

I need some help with this if any1 wud be kind enuff to support me with the codes..Explanation if possible..

Its as follows :

Create a decimal variable whose starting value is 5.
While the value remain above 1 print the following message on the screen.
"WOW"
Decrement the value of the above mentioned variable by 1 every time the loop gets executed.

Thanx alot ;)
 
That is undoubtedly homework so how about you make a start and then we can help if you get stuck. From the wording it sounds like you are intended to use a While or Do While loop.
 
Noo its not homework.. I just need to have the codes i dont have an idea on how to start i need this ASAP cuz im practising.So a start off by you would be appreciated :) thanx alottt
 
So what parts don't you understand? Declaring a Decimal variable, using a loop, displaying a message on screen or decrementing a variable? Can you do any or all of those things in isolation? Have you read the help topics I linked to for the While and Do loops? If you're learning on your own then you must have read about how to do these things in the book that contains that exercise. You must be able to make some sort of start.
 
// write & run this in console application

Dim i As Integer = 5
Do
Console.WriteLine("WOW")
i = i - 1
If (i = 0) Then
Exit Do
End If
Loop
Console.ReadLine()
 
VB.NET:
for i as integer =0 to 5
Console.WriteLine("WOW")
next
Console.ReadLine()
VB.NET:
Dim i AsInteger = 5
while i>=0
Console.WriteLine("WOW")
i-=1
end while
Console.ReadLine()
 
Back
Top