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
What is short in c#?
Why do we use readonly in c#?
How can you use abstract class and interface?
How to do and Apply Themes to Datagrid,Lable,Textbox,etc., in C#.NET 2005 Windows Application? (like who we will do themes in ASP.NET using .CSS and .SKIN files). Urgent!!
How do I convert a string to an int in c#?
What is difference between === and ==?
How do you clear a list in c#?
What is object array in c#?
Tell me the difference between call by value and call by reference.
What are the concepts of dispose method?
What is a clr host?
Illustrate namespaces in c#?
Why do we use yield in c#?
Which are the loop types available in c#?
What is class method?