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

Which string method is used for concatenation of two strings in c#?

469


How do I simulate optional parameters to com calls?

505


Can we have multiple threads in one app domain?

517


What is reference types in c#?

475


What's the difference between the debug class and trace class? Documentation looks the same.

502






Explain the difference between class and interface in .net?

432


Assembly Code. in Rejester AL. How do Contast Replece( or Change): Bit D3 With Bit D4 and Bit D2 With Bit D5 and Bit D1 With Bit D6 and Bit D0 With Bit D7 I am Not Know Very Well Write English.

1445


What are the differences between value types and reference types?

548


What is predicate c#?

542


Is c sharp free?

540


Explain the difference between Metadata and Manifest

542


What are Regex / regular expressions ?

583


What is cshtml extension?

516


What are the 3 types of comments in c#?

519


What is a static property. Give an example?

518