+ 1

Help me please, C# program language

You are an elementary school teacher who took students to multiplication. You suggest using multiplication by 3 as an example. You are given a program that takes the number N in qualitative input. Write a program that will print all numbers from 1 to N, replacing all multiples of 3 with "*". https://code.sololearn.com/c5bJ1xx7nZyN/?ref=app

11th Jul 2022, 7:53 AM
Кемран
Кемран - avatar
10 odpowiedzi
+ 1
Hint: the multiples of 3 can be recognized with operator %.
11th Jul 2022, 8:03 AM
JaScript
JaScript - avatar
+ 1
Thank you, I'm really very grateful to you🙏🏻
11th Jul 2022, 9:42 AM
Кемран
Кемран - avatar
+ 1
everything works, thank you very much, I am very grateful to you, savior 🙏🏻
11th Jul 2022, 11:02 AM
Кемран
Кемран - avatar
0
I know this but how can I do it? N%3 but where should I put this? in if or where?
11th Jul 2022, 8:06 AM
Кемран
Кемран - avatar
0
You need to create a loop from 1 to N as above described and divide modulo the loop variable.
11th Jul 2022, 8:18 AM
JaScript
JaScript - avatar
0
I still don’t understand how to do it, I’m a newbie and besides, there is no paid subscription and training is not easy for me.
11th Jul 2022, 8:30 AM
Кемран
Кемран - avatar
0
for(int n=1; n<=number; n++){ if(n%3 == 0){ // your code } else { // your code } }
11th Jul 2022, 8:40 AM
JaScript
JaScript - avatar
0
bro, I almost did help me more plz. I did everything, only now I don’t understand how to make it so that instead of multiples of 3 there is *. it goes like this for me: 12true45true7 and it should be 12*345*7 how can I do it please tell me 🙏🏻
11th Jul 2022, 10:23 AM
Кемран
Кемран - avatar
0
//The test is made in the if statement. So you need instead: //Console.Write(n%3==0); where n%3==0 gives you true Console.Write("*");
11th Jul 2022, 10:58 AM
JaScript
JaScript - avatar
0
I'm shocked, I almost guessed. I did this, but a little differently, I did this console.write(n%3=="*");, now everything became clear
11th Jul 2022, 11:00 AM
Кемран
Кемран - avatar