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 Is The Difference Between ViewState and SessionState?
Explain the use of Mutex in C#?
0 Answers Sans Pareil IT Services,
How to rotate an Image in C#?
0 Answers Petranics Solutions,
I want to single value if you give any integer value. Below are examples 1. Input: 123 Output: 6 2. Input: 99 9+9=18 1+8 Output: 9 How to get above output?
Why do we need indexers in c#?
What is a nullreferenceexception and how do I fix it?
How Do You Convert A Value-type To A Reference-type?
What is the difference between gettype and typeof in c#?
Hi Friends, I am going through Siemens Interview Procedure from last 1+1/2 months. I went through 1 written + 2 Technical + 1 Managerial Round process after which I got call from HR informing that "you are selected and we would like to meet you for HR round". HR round was very nominal compared to MR. HR Round last for hardly 5 mins. They told me that you will get the final result on Friday. Still I have not received any feedback from them. Please help!!!
destructor, Dispose, Finalize - How they relate to each other
How would you describe encapsulation in c#?
What is service contract