0

Up we go challenge C#. Can't output all five hours as required.

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { //your code goes here int x = 1; while (x <= 5){ x *= 80; Console.WriteLine(x); //x *= 80; } /*for (int x=1; x<5; x++){ x *= 80; Console.WriteLine(x); }*/ } } }

18th Sep 2022, 4:34 PM
Charles Mwaniki
Charles Mwaniki - avatar
3 Respuestas
+ 1
for (int x=1; x<=5; x++) Console.WriteLine(80*x);
18th Sep 2022, 4:41 PM
SoloProg
SoloProg - avatar
+ 1
In single iteration, x = 1 x <= 5 true x *= 80 x <= 5 => (80 <= 5) false. Loop stops.
18th Sep 2022, 4:43 PM
Jayakrishna 🇮🇳
+ 1
Thank you buddies
19th Sep 2022, 5:30 AM
Charles Mwaniki
Charles Mwaniki - avatar