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
Is static thread safe?
Can arraylist store different data types in c#?
Is linkedhashset synchronized?
What is the difference between abstract and abstraction?
Wcf and what is difference between wcf and web services?
Can you declare struct members as protected?
How do you declare an arraylist?
What is a function c#?
What is inner class in c#?
What is an example of a delegate?
What is mvc firstordefault?
What is a nested type. Give an example?
What is base class in c#?
Explain how do you convert a value-type to a reference-type?
Explain 'structure padding'?