how can i get this 123456789
1234 6789
123 789
12 89
1 9
Answer / 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 |
What debugging tools come with the .NET SDK?
Explain polymorphism in c# with a simple example?
Define multicast delegate in c#?
What is escape sequence in c#?
Explain manifest in c#.
Is as operator in c#?
What is the differnce between Array and Hash Table?
How do you mark a method obsolete?
What is difference between the "throw" and "throw ex" in .net?
What is string method in c#?
Is comparator a functional interface?
Explain what a diffgram, and a good use for one Define diffgram? How it be used?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)