int count;
for(count=10;count<=1;count--)
{
Console.write("Hello");
} Why Doesnt appear nothing when I run this code?? have logic for me...
Short summary and practical fix tying the thread together: correctly pointed out that the loop never ran because the loop condition was false at the start, and correctly reminded that C# is case-sensitive. Below is a minimal, working console example that shows a safe pattern and keeps the window open so you can see output.
using System;
class Program
{
static void Main()
{
for (int i = 1; i <= 10; i++)
{
Console.WriteLine("Hello");
}
Console.WriteLine("Finished. Press any key to exit.");
Console.ReadKey();
}
} Key things to check when a loop prints nothing:
++ for ascending, -- for descending). An inverted comparison will make the loop skip entirely.for(...) header (for(...);) — that creates an empty loop and the following block runs once after the loop.Console.Write / Console.WriteLine must be capitalized and using System; is needed for Console.Console.ReadKey() to pause.If the loop still surprises you, add a debug print or breakpoint inside the loop to inspect the loop variable and condition before and during the run. This often makes the mistake obvious faster than guessing.
Jump to Post— camilojvarona 0Hi,
Write is with capital letter like
Console.Write("Hello");. Remember that C# is case-sensitive.
Regards,
Camilo
int count;
for(count=10;count>=1;count--)
{
Console.write("Hello");
} Try it now. Looks like you were just confused about how the for loop works. The second statement means 'as long as it is true' but 10 is never <= than 1.
Regards
Hi,
Write is with capital letter like Console.Write("Hello"); . Remember that C# is case-sensitive.
Regards,
Camilo
int count; for(count=10;count>=1;count--) { Console.write("Hello"); }Try it now. Looks like you were just confused about how the for loop works. The second statement means 'as long as it is true' but 10 is never <= than 1.
Regards
thx..
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.