+ 1
Problem with lesson 23
I've done a task but the result at the end still not noticed that I've done it right. All tests passed right. Result shows wrong answer for a task and offers me to try it again. I don't know what should I do in this case. Pls help.
5 Answers
+ 1
What is the purpose of 2nd if condition?
You are adding extra * by 2nd if condition..
+ 1
int number = Convert.ToInt32(Console.ReadLine());
int r = 1;
do {
if (r%3==0){
Console.Write ("*");
}else {
Console.Write (r);
}
if (number%3==0){
Console.Write ("*");
}
r++;
} while (r <= number);
+ 1
The second "if" condition is needed if the entered number is also divisible by 3. In the terms of the task it was said about it.
So, thanks, without second "if" it works :)
+ 1
Seems logical. I agree, I didn't think about it. You're right :)
0
you are using condition r<=number so it covers for entered number also... so no need 2nd if.
You're welcome..