Problem with Floyd's Triangle (c#)
This is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace HelloWorld
{
public class Program
{
public static void Main(string[] args)
{
int rows = Convert.ToInt32(Console.ReadLine()); //get the amount of rows to draw
int row = 1; //the row that we are currently working on
int num = 1; //the number that we are currently writing
while(row <= rows) //run while we have not written all rows
{
int i = 0; //how many times we've iterated
while(i < row) //run once for each number in row
{
Console.Write($"{num} "); //write the number
num++; //next number
i++; //iterate once
}
Console.Write("\n"); //start the next level of the triangle
row++; //iterate the row that we are writing
}
}
}
}
It prints the triangle:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55
But when I submit, it says, "0/1 Test Cases"
Does anyone know what I'm doing wrong?