+ 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
10 Answers
+ 1
Hint: the multiples of 3 can be recognized with operator %.
+ 1
Thank you, I'm really very grateful to you🙏🏻
+ 1
everything works, thank you very much, I am very grateful to you, savior 🙏🏻
0
I know this but how can I do it? N%3 but where should I put this? in if or where?
0
You need to create a loop from 1 to N as above described and divide modulo the loop variable.
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.
0
for(int n=1; n<=number; n++){
if(n%3 == 0){
// your code
} else {
// your code
}
}
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 🙏🏻
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("*");
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