- 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
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.
+ 2
Tag you language in your post and maybe post an attempt
+ 2
I'm learning c#
+ 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.
+ 1
Seems like you need to convert to string
+ 1
Thanks šā¤ļø
+ 1
Here is the for loop
For (int i=1;i<=number;i++){
if(i%3==0){Console.Write("*");}
Else{Console.Write(i);}
}
0
I don't how to write a program to show this type of output
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
}
}
}
0
Can anyone Teach me by Typing Code
Then I can understand the logic