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 / santosh sasane

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

//( Solved With the Console Application in .net )

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{

class Program
{

static void Main(string[] args)
{ int q = 10;
int p = 10;
for (int i = 0; i < 10; i++)
{
for (int j = i; j <= i; j++)
{
StringBuilder a = new StringBuilder();
if (q == 10)
{
a.Append(j - i);
}
for (int k = q; k <= 9; k++)
{
a.Append(k);
if (k == 9) { a.Append(0); }
}
for (int g = 9; g >= q; g--)
{
a.Append(g);
}
q--;
p--;
Console.WriteLine(a);
}
}
Console.ReadLine(); // Used for hold the Disply
}
}
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between an implicit conversion and an explicit conversion?

687


What are most desktop applications written in?

667


What is form feed in c#?

733


What are the different states of a thread?

707


What is a .exe extension files? How is it similar to .dll extension files?

776


How long can a string be c#?

666


What is difference between static and constant variable?

762


Explain the difference between “as” and “is” operators used in c#?

702


What is a factory in c#?

667


What is a interface in c#?

657


Please explain value types and reference types used in c#?

653


What is a .aspx file?

630


What is super class in c#?

622


What are the 2 kinds of data type conversions in c#?

679


What is Assembly. and Describe type of assembly. why most developer happy with private assembly.

774