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 / tanvi

Assignment 1:
namespace PrintExcercise
{
class Program
{
static void Main(string[] args)
{
string xx;

for (int i = 0; i < 8; i++)
{
xx = "XX XX";
if (i == 3 || i == 4)
{
xx = xx.Remove(xx.Length - 1, 1);
xx = xx.Remove(0, 1);
}

Console.WriteLine(xx);
}

}
}
}

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 part of a method signature in c#?

646


What is a singleton unity?

741


What's the difference between class and object?

680


Where is the keyword void used?

713


What are properties in C#?

716


Why dataset is used in c#?

714


Is hashset serializable c#?

691


Explain the accessibility modifier protected internal?

632


What is data quality assurance?

626


How does dll hell solve in .net?

675


Can arraylist hold primitive types?

740


Enlist the different types of classes in c#?

697


What are the collections in c#?

659


Enlist all the components of an ado.net framework?

645


Are c# destructors the same as c++ destructors?

756