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
Enlist the different types of classes in c#?
If the interface in c# only contains the declaration of the methods and we need to define those methods in the class, then why we use the interface?
What is boxing in c#?
What are desktop applications examples?
What is delegate in c#?
How does aspect oriented programming work?
Explain About Virtual functions and their use.
What is the usage of OLE?
What is or operator in c#?
Can a class have static constructor?
Can we have two main methods in c#?
What is default class in c#?
What is a deadlock lock?
Why do we use reflection in c#?
You are creating a custom usercontrol, some of the newly created properties are shown in the properties window. How you can hide a new property named theme from the properties window?