+ 1

How do I solve the C# Module 2 quiz? (Multiple of 3)

Multiple of 3 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

27th Jun 2021, 2:07 PM
Shafe Hayat Khan
Shafe Hayat Khan - avatar
2 Réponses
+ 11
All you need to use an if-else statement inside a loop. Print `*` if your input is divided by 3. Else, number That's it!
27th Jun 2021, 2:40 PM
Simba
Simba - avatar
+ 2
Thank you soo much Simba! It was stuck for sooooo long that I lost hope and was gonna rage quit.
28th Jun 2021, 4:41 AM
Shafe Hayat Khan
Shafe Hayat Khan - avatar