C# example | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
- 3

C# example

You are an elementary school teacher and explaining multiplication to students. You are going to use multiplication by 3 as your example. The program you are given takes N number as input. Write a program to output all numbers from 1 to N, replacing all numbers that are multiples of 3 by "*". Sample Input 7 Sample Output 12*45*7

1st Sep 2021, 5:58 PM
Čus PeÅ„a
Čus PeÅ„a - avatar
1 Resposta
+ 1
Well, you know how to take input, right? šŸ˜‡ Console.ReadLine(). You need to convert that to a number because input comes as string data type (lesson about "taking input"): Convert.ToInt32(...) Then you can take a loop, a for-loop for example, and inside you use an if-statement to find the numbers that are divisible by 3 (num%3 == 0). With that you should be able to complete the task šŸ€šŸ’•šŸ˜‡
1st Sep 2021, 6:06 PM
Agnes Ahlberg
Agnes Ahlberg - avatar