logo CodeStepByStep logo

FloydsTriangle

Language/Type: VB for

Write a subroutine named FloydsTriangle that accepts an integer k as a parameter and prints a k-row version of Floyd's triangle. Floyd's triangle is a sequence of increasing numbers, starting with 1, where each Nth row of numbers displays the next N numbers in the sequence. For example, the call of FloydsTriangle(5) should print the following console output:

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

If k is 0 or negative, print no output.

Function: Write a VB function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.