Complete the method public static void PrintArrayInStars(int[] array) in the template to make it print a row of stars for each number in the array. The amount of stars on each row is defined by the corresponding number in the array.
You can try out the printing with this example:
int[] array = {5, 1, 3, 4, 2}; PrintArrayInStars(array);
- using System;
- using System.Collections.Generic;
-
- namespace exercise_82
- {
- class Program
- {
- public static void Main(string[] args)
- {
-
- int[] array = { 5, 1, 3, 4, 2 };
- PrintArrayInStars(array);
- }
-
- public static void PrintArrayInStars(int[] array)
- {
- int i = 0;
- while (i < array)
- {
- Console.Write("*");
- i++;
- }
- }
- }
- }