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 / vinay s m
Assignment 2 :
static void Main(string[] args)
{
int n = 10;
for (int i = 0; i < n; i++)
{
StringBuilder a = new StringBuilder();
for (int j = n - i; j < n; j++)
{
a.Append(j);
}
a.Append(0);
for (int k = n-1; k >=n-i; k--)
{
a.Append(k);
}
Console.WriteLine(a);
}
Console.Read();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what is the Difference between the public and private ?
List the differences between method overriding and method overloading?
What is .dbml file?
Why do we use static methods in c#?
What is dependency injection?
What is meant by desktop application?
What is datetime parse in c#?
Enlist some of the properties of a thread class?
What is main thread in c#?
What does readonly mean in c#?
What do multicast delegates mean?
Explain a MSIL ? Why is it appreciated by all developers?
What is the difference between ienumerable and enumerator?
What does firstordefault mean in c#?
What does the initial catalog parameter define in the connection string?