How to invert this so that the result shows backwards? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to invert this so that the result shows backwards?

using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int number = Convert.ToInt32(Console.ReadLine()); while(number>0){ if(number%3==0) { Console.Write("*"); } else { Console.Write(number); } number--; } } } }

4th Jun 2021, 4:34 PM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
4 Answers
+ 2
using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int number = Convert.ToInt32(Console.ReadLine()); int i = 1; while (i<=number) { if (i%3==0) { Console.WriteLine("*"); } else { Console.WriteLine(i); } } } } }
4th Jun 2021, 4:49 PM
Eashan Morajkar
Eashan Morajkar - avatar
0
The result shows 7*54*21. I want it to show 12*45*7.
4th Jun 2021, 4:34 PM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
0
Wow it was kinda obvious. Makes me feel dumb. Thanks a lot though.
4th Jun 2021, 4:53 PM
Joel Sebastian Jijo
Joel Sebastian Jijo - avatar
0
You're welcome
4th Jun 2021, 4:55 PM
Eashan Morajkar
Eashan Morajkar - avatar