I want Help to solve this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

I want Help to solve this

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

10th Mar 2022, 11:35 PM
AbuBakar-CH
AbuBakar-CH - avatar
10 Answers
+ 4
AbuBakar-CH For example the number is 9 , you will begin with 1 and check all the inclusive 9. Means you go with for loop through all these numbers and check: if number %3==0, if true put "*" in place of number, else just put the number.
11th Mar 2022, 7:40 AM
SoloilSole
SoloilSole - avatar
+ 2
Tag you language in your post and maybe post an attempt
10th Mar 2022, 11:42 PM
Ion Kare
Ion Kare - avatar
+ 2
I'm learning c#
10th Mar 2022, 11:42 PM
AbuBakar-CH
AbuBakar-CH - avatar
+ 2
AbuBakar-CH hi, You just need a for loop and inside the loop if-else statement. I reccomend you to check this lessons again in C# and try again.
11th Mar 2022, 7:22 AM
SoloilSole
SoloilSole - avatar
+ 1
Seems like you need to convert to string
10th Mar 2022, 11:38 PM
Ion Kare
Ion Kare - avatar
+ 1
Thanks 😁❤️
11th Mar 2022, 7:51 AM
AbuBakar-CH
AbuBakar-CH - avatar
+ 1
Here is the for loop For (int i=1;i<=number;i++){ if(i%3==0){Console.Write("*");} Else{Console.Write(i);} }
12th Mar 2022, 11:18 PM
Abdulrahman alaa
0
I don't how to write a program to show this type of output
10th Mar 2022, 11:41 PM
AbuBakar-CH
AbuBakar-CH - avatar
0
using System; using System.Collections.Generic; namespace SoloLearn { class Program { static void Main(string[] args) { int number = Convert.ToInt32(Console.ReadLine()); //your code goes here } } }
10th Mar 2022, 11:42 PM
AbuBakar-CH
AbuBakar-CH - avatar
0
Can anyone Teach me by Typing Code Then I can understand the logic
11th Mar 2022, 7:25 AM
AbuBakar-CH
AbuBakar-CH - avatar