0
Please can any one help me understand this code???( in the discreption)
using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int number = Convert.ToInt32(Console.ReadLine()); //your code goes here string result = ""; int i = 1 ; while ( i <= number ) { if ( i % 3 == 0 ) { result = result + '*'; } else { result = result + i.ToString(); } i++; } Console.WriteLine ( result ); } } }
2 Answers
+ 1
This code will ask for a number (since you use Convert.ToInt32) and will write a string with ascending numbers (12345...) until the number given by the user, but it will skip the number and write a * on multiples of three.
Example:
Input:
10
Output:
12*45*78*10
+ 1
What exactly do you not understand?