Why is it not showing any output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Jan 2021, 10:14 AM
aka :)
aka :) - avatar
3 Answers
+ 10
MrDevEzeoke , you are returning some data from the function, but it is not used, and there is also missing an output statement. it could be done like this: ... int[] result = ArrayOfMult(number,length); foreach (var item in result) { Console.WriteLine(item); } ...
23rd Jan 2021, 10:27 AM
Lothar
Lothar - avatar
+ 4
Because it only returns array. You should print each element of returned array (preferably in Main). Try to use this: foreach(var item in ArrayOfMult(number, length)) { Console.WriteLine(item.ToString()); } instead of: ArrayOfMult(number,length); (other variants: https://stackoverflow.com/questions/16265247/printing-all-contents-of-array-in-c-sharp )
23rd Jan 2021, 10:28 AM
#0009e7 [get]
#0009e7 [get] - avatar
+ 2
Lothar and get Thank you both of you. I have finally updated it and now it works.
23rd Jan 2021, 11:47 AM
aka :)
aka :) - avatar