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

What is difference between arraylist and list in c#?

428


Can we set image Source dynamically using C# in WPF application?

624


What is connection pooling in ado.net?

535


To whom a method is accesssed if it is marked as protected internal ?

605


If you donot specify an access modifier for a method, what is the default access modifier?

535






What is IL / CIL / MSIL?

653


Differentiate between response.expires and response.expiresabsolute?

537


what is a structure in c#

532


What is Global Assembly Cache (GAC) and what is the purpose of it? (How to make an assembly to public? Steps) How more than one version of an assembly can keep in same place?

558


What is the usage of transponders?

537


There were a lot of questions asked, so I will list the topic (and add a what is "topic" and know pros/cons). Extreme programming, what is a transaction, various SDLC design approaches, what is a namespace, define a good test case, what is a stored proc, webservice? design patterns? linker? compiler? access modifiers? stack vs. queue? arrays vs. linked lists? sorting algorithms? recursion? OOP principles?

1581


Why do we need abstraction in c#?

483


What is dbcontext c#?

482


What is difference between .net and c#?

459


Distinguish between finally and finalize blocks?

506