0
ماحل المشكلة التالية؟ وما الخطأ في كودي؟
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 "*".
2 Answers
+ 3
Zina Shekh Alzoor
You have to print i and check i % 3 == 0
You didn't use else so everytime same number will be print
You have to write
if (i % 3 == 0)
//print *
else
//print i
0
static void Main(string[] args)
{
int number = Convert.ToInt32(Console.ReadLine());
//your code goes here
{ for (int i=1;i<=number;i++)
{
if(number%3==0)
{
Console.Write("*");
}
Console.Write (number);
}