how can i get this 123456789
1234 6789
123 789
12 89
1 9
Answer Posted / tanvir anwar
int n = 9; // you can use any odd number for similar pattern
int mid = (n+1)/2;
for (int i = 0; i < mid; i++)
{
for (int j = 1; j <= n; j++)
{
if (j <= mid-i || j >= mid+i)
Console.Write({0}, j);
else
Console.Write(" ");
}
Console.WriteLine();
}
| Is This Answer Correct ? | 10 Yes | 2 No |
Post New Answer View All Answers
How does the clr work?
Why do we need constructors?
Are c# objects passed by reference?
Explain About disco and uddi
What is ienumerable and iqueryable?
Can you inherit from a sealed class?
Explain the different types of delegates used in c#.
In which order the constructor is called for an inherited class?
Is dictionary reference type c#?
What is the difference between new and override in c#?
Describe the parts of assembly.
What is a scope in c#?
What is string programming language?
Is c# scripting language?
What is ienumerable t in c#?