Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how can i get this 123456789
1234 6789
123 789
12 89
1 9



how can i get this 123456789 1234 6789 123 789 ..

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

Post New Answer

More C Sharp Interview Questions

What is CLR and its application.?

0 Answers   MCN Solutions,


What is the use of jit ? Jit (just - in - time) is a compiler which converts msil code to

0 Answers  


What is use of super class

4 Answers   NIIT,


How do you prevent a class from being inherited?

0 Answers  


Where is the main method in c#?

0 Answers  


Why is it a bad idea to throw your own exceptions?

4 Answers  


How can i Spawn a Thread

0 Answers   HCL,


What is the benefit of using interface in c#?

0 Answers  


What is a di class?

0 Answers  


What is difference between array and collection in c#?

0 Answers  


Explain how obfuscator works in .net

0 Answers  


Why do we need interface in c#?

0 Answers  


Categories