Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
Jobreceive.com for sale
Blogerwiki
Updated:
Yesterday at 8:55 PM
Post Your Vehicle for Sale — FREE! - https://libro.lk
Kalu_Puth
Updated:
Yesterday at 7:38 PM
ඔයාගෙ Assignment හෝ Thesis එක හරියට හදාගමු
ErMurazor
Updated:
Saturday at 10:52 PM
Ad icon
BlackWall V2ray servers
hu KANNA
Updated:
Sep 23, 2026
Peppa Pig Family Plush Toy Set – 5 Characters
anil1961
Updated:
Sep 19, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Java code help - තේරෙන්නෙ නෑ බං..
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="gembaknb" data-source="post: 21612696" data-attributes="member: 515883"><p><strong>Java code help - තේරෙන්නෙ නෑ බං..</strong></p><p></p><p>[CODE]</p><p>class Example{</p><p> public static void main(String args[]){</p><p></p><p> int A[][]=new int[3][3]; // Creating the Magic Matrix</p><p> int i=0,j=1,k=1;</p><p></p><p> while(k<=9){</p><p> A[i][j] = k++;</p><p> i--; // Making one step upward</p><p> j++; // Moving one step to the right</p><p></p><p> if(i<0 && j>2) // Condition for the top-right corner element</p><p> {</p><p> i = i+2;</p><p> j--;</p><p> }</p><p></p><p> if(i<0) // Wrapping around the row if it goes out of boundary</p><p> i = 2;</p><p></p><p> if(j>2) // Wrapping around the column if it goes out of boundary</p><p> j = 0;</p><p></p><p> if(A[i][j]>0) // Condition when the cell is already filled</p><p> {</p><p> i = i+2;</p><p> j--;</p><p> }</p><p> }</p><p> </p><p></p><p> /* Printing the Magic matrix */</p><p> for(i=0;i<3;i++)</p><p> {</p><p> for(j=0;j<3;j++)</p><p> {</p><p> System.out.print(A[i][j]+ "\t");</p><p> }</p><p> System.out.println();</p><p> }</p><p> }</p><p>}</p><p></p><p>[/CODE]</p><p><span style="font-size: 15px"> මේක මං internet එකෙන් ගත්ත code එකක් බං. Solve 3x3 magic puzzele.. </span></p><p><span style="font-size: 15px">තේරෙන්නෙ නෑ බං මොනවද කරල තියෙන්නෙ. ඇයි එහෙම කරල තියෙන්නෙ කියල.</span></p><p><span style="font-size: 15px"></span></p></blockquote><p></p>
[QUOTE="gembaknb, post: 21612696, member: 515883"] [b]Java code help - තේරෙන්නෙ නෑ බං..[/b] [CODE] class Example{ public static void main(String args[]){ int A[][]=new int[3][3]; // Creating the Magic Matrix int i=0,j=1,k=1; while(k<=9){ A[i][j] = k++; i--; // Making one step upward j++; // Moving one step to the right if(i<0 && j>2) // Condition for the top-right corner element { i = i+2; j--; } if(i<0) // Wrapping around the row if it goes out of boundary i = 2; if(j>2) // Wrapping around the column if it goes out of boundary j = 0; if(A[i][j]>0) // Condition when the cell is already filled { i = i+2; j--; } } /* Printing the Magic matrix */ for(i=0;i<3;i++) { for(j=0;j<3;j++) { System.out.print(A[i][j]+ "\t"); } System.out.println(); } } } [/CODE] [SIZE="4"] මේක මං internet එකෙන් ගත්ත code එකක් බං. Solve 3x3 magic puzzele.. තේරෙන්නෙ නෑ බං මොනවද කරල තියෙන්නෙ. ඇයි එහෙම කරල තියෙන්නෙ කියල. [/SIZE] [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom