# I am a 56 year old programmer.

FratBro23
Category:
Programming
Price: \$5 USD

Question description

I am a 56 year old programmer.  I am working on a program that needs me to convert a linear position into its respective 9x9 (0 based [8,8]) array position.  For example: position 8 might be defined like this:  [ n = linear position, x = first array position, y = second array position ]

x = (n / 8) -1  :  row = (8 / 8) -1 = 0 correct

y = n - (8 * x) : col = 8 - (8 * 0) = 8 correct

x = (22 /8) - 1 : row = (3) rounded up -1 = 2 correct

y = 22 - (8 *2) col = 22 - 16 = 6 correct

These formulas work until the number n gets larger and x and y are forced to be larger than the array

Can you help me determine what I am doing wrong. Your help would be appreciated.

(Top Tutor) Daniel C.
(997)
School: University of Virginia
Studypool has helped 1,244,100 students

1831 tutors are online

### Related Programming questions

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors