0

How can i solve? I am new

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

14th Dec 2020, 9:32 PM
Antonio
Antonio - avatar
3 Antworten
0
That is from C# course. Just go back some lessons, you will find everything you need: for-loop and if-else-statement. For output use Console.Write()
14th Dec 2020, 9:50 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
Also learn how to take user input in C#
15th Dec 2020, 4:08 AM
Sonic
Sonic - avatar
0
using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { // transform to integer int number = Convert.ToInt32(Console.ReadLine()); //your code goes here for(int i = 1; i < number; i++){ if(i % 3 == 0){ Console.WriteLine("*"); }else{ Console.WriteLine(i); } } Console.WriteLine(number); } } }
7th Mar 2021, 8:29 PM
Elias Prado
Elias Prado - avatar