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

Is c# an array?

0 Answers  


Tell me something about Exceptions. What is the common exception class?

4 Answers   HCL,


What are methods c#?

0 Answers  


Can properties be static in c#?

0 Answers  


Is c# or c++ better for games?

0 Answers  


Is for loop faster than foreach?

0 Answers  


What is polymorphism and its types in c#?

0 Answers  


Why do we need escape characters?

0 Answers  


Is arraylist type safe in c#?

0 Answers  


what are the events in delegate?

2 Answers   Choice Solutions,


Why are strings immutable c#?

0 Answers  


Perfect Example Of While And Do-While Loop In C#.Net ?

0 Answers   Wipro,


Categories