Arsalan's Musings on Software

Software design and development techniques, ideas, and source code snippets…

Simple zig-zag numeric spiral

leave a comment »

I propose the following problem. Take the number of columns and a series of numbers between 10 and 99 as input and create a zig-zag pattern on console output. The output should be centered so that it fills an 80 char wide screen. For example,

prompt>ZigZag 3 12 45 78 48 34 67 90 23 72 67 34 56 17 32 88

will give the following output:

12
                                                             45
                                                                                                                               78
                                                            48
34
                                                            67
                                                                                                                               90
                                                            23
72 
                                                             67 
                                                                                                                               34
                                                             56
17
                                                             32
                                                                                                                               88

———————————————————————————

I will try to write C# code to solve this problem below within a day or two.

Advertisements

Written by Arsalan A.

January 8, 2008 at 2:49 pm

Posted in Code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: