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...

Assignment # 1 Print the pattern given below using single
printf statement

XX XX
XX XX
XX XX
X X
X X
XX XX
XX XX
XX XX


Assignment # 2 Print the pattern given below using single
printf statement
(please do NOT use the string function below)
0
909
89098
7890987
678909876
56789098765
4567890987654
345678909876543
23456789098765432
1234567890987654321

Answer Posted / vinay s m

Assignment 2 :
static void Main(string[] args)
{
int n = 10;
for (int i = 0; i < n; i++)
{
StringBuilder a = new StringBuilder();
for (int j = n - i; j < n; j++)
{
a.Append(j);
}
a.Append(0);
for (int k = n-1; k >=n-i; k--)
{
a.Append(k);
}
Console.WriteLine(a);
}
Console.Read();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between constants and read-only?

900


Can an int be negative c#?

1016


Explain about multithreading?

1009


What are the steps to create an assembly and add it to the gac?

862


What is difference between float and decimal?

950


What is instantiating a class in c#?

1007


What exactly is serverless?

826


What is the difference between ienumerable and enumerable?

894


How can I check the type of an object at runtime?

946


Which property of the textbox cannot be changed at runtime?

935


What is difference between private and protected?

986


Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?

1037


What does int32 mean in c#?

887


Is post back c#?

910


Does the variables of a private class-level inherited?

1000