C# Module 23 Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C# Module 23 Question

I don't understand what it is this question is asking us to do. Is it asking us to replace the values that are multiples of three with "*"? If so, why are numbers listed that aren't multiples of 3 in the output? "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"

29th Jun 2022, 10:14 PM
MAB
MAB - avatar
1 Answer
+ 2
Your program is to print out the consecutive numbers, up through the input number. Before it prints each number the program must detect whether the number is a multiple of 3. If so, then it must print * instead of the number. Otherwise it should print the number because it is not a multiple of 3. Non-multiples of 3 are included in the output so the students can focus on the position of the asterisks (*) and see where multiples of 3 fit in. It is educational for them to see and recognize the numeric spacing.
30th Jun 2022, 12:08 AM
Brian
Brian - avatar