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
Which is faster abstract class or interface in c#?
Explain polymorphism in c# with a simple example?
What is the execution entry point for a c# console application?
Which framework is best for desktop application?
What is delimiter in c#?
What is console read in c#?
how dot net compiled code will become platform independent?
Explain static class members.
What is .cshtml file?
How do I create a new form in c#?
Constructor to an arbitrary base constructor?
What are get and set in c#?
What is argument in c#?
What is scope c#?
What is for loop in c#?