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 / santosh sasane

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

//( Solved With the Console Application in .net )

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{

class Program
{

static void Main(string[] args)
{ int q = 10;
int p = 10;
for (int i = 0; i < 10; i++)
{
for (int j = i; j <= i; j++)
{
StringBuilder a = new StringBuilder();
if (q == 10)
{
a.Append(j - i);
}
for (int k = q; k <= 9; k++)
{
a.Append(k);
if (k == 9) { a.Append(0); }
}
for (int g = 9; g >= q; g--)
{
a.Append(g);
}
q--;
p--;
Console.WriteLine(a);
}
}
Console.ReadLine(); // Used for hold the Disply
}
}
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is string null or empty?

852


What is CASPOL?

991


Is list ienumerable c#?

948


Why generics are used?

848


What is a hash table in c#?

935


You have got 1 million parking slots. At a time a parking slot can be free or not. To get next slot easily which data structure to implement?

1029


What is default c#?

886


What is strong name assembly?

820


Is it possible to inline assembly or il in c# code?

963


Explain the difference between Response.Write () and Response.Output.Write ().

896


Explain why do I get an error (cs1006) when trying to declare a method without specifying a return type?

778


What is xamarin used for?

876


Explain about ODP.net

1184


What is parameterized constructor?

876


What is private virtual in C#?

963