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
3 Answers
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()
0
Also learn how to take user input in C#
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);
}
}
}