0

So I'm a highschool student in CMPT Programming 1. The assignment is: Write a program to print the value of a series of numbers from 0-9 in descending order. Now the lesson gives me information on the "for statement", "while statement", and the "do-while statement". It gives these examples:

For statement code

Module Module1
' Sub Main()
For i As Integer = 0 to 10 step 1
    System.Console.Writeline(i)
    Next i 
    End Sub
End Module

While Condition

Dim i As Integer = 0 
While i < 50
System.Console.Writeline(i)
i = i + 10 
End While

Do-While

Module Module 1
    Sub Main()
    Dim x as Integer
Do
  System.Console.WriteLine(x)
  x = x + 1
Loop While x < 10
End Sub
End Module

These are the examples for my lesson. So how do I write a value of a series of numbers from 0-9 in descending order. It also gives me the If-then, If-Then Else, and Switch Statements code if that's helpful.

2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by BitBlt
1

While we won't do your homework for you (we do ask that you make at least an attempt!) I can give you some hints: In a "For" loop, you can have a negative "step"...in a While loop, you can initialize your counter variable to something besides zero...same thing in your do while.

Hope that helps! Good luck with your class!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.