Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25
Like Tree5Likes

Thread: Need help to write the code

  1. #21
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default Re: Need help to write the code

    @noobplus
    Why are you trying to write the code for the OP instead of helping the OP to understand the problem and come up with a design so he can write the code himself???
    You are not helping the OP learn to write programs by solving his problems for him!!!
    If you don't understand my response, don't ignore it, ask a question.

  2. #22
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: Need help to write the code

    hi, ive edited line 38 of my code

    regards
    dhilip

  3. #23
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: Need help to write the code

    Quote Originally Posted by Norm View Post
    @noobplus
    Why are you trying to write the code for the OP instead of helping the OP to understand the problem and come up with a design so he can write the code himself???
    You are not helping the OP learn to write programs by solving his problems for him!!!
    I wanted to tell him the concept of creating forward and reverse loops .. and wont repeat it again sorry for that

    regards
    dhilip

  4. #24
    Galichka is offline Member
    Join Date
    Mar 2012
    Posts
    13
    Rep Power
    0

    Default Re: Need help to write the code

    thank you,
    dhilip!
    i assigned int r =7;
    int c = 7;
    and changed the value 8 in your code to a.length;
    now it works .
    thank you very much

  5. #25
    noobplus's Avatar
    noobplus is offline Senior Member
    Join Date
    Feb 2012
    Location
    chennai,south of India(south east of asia)
    Posts
    232
    Rep Power
    3

    Default Re: Need help to write the code

    Hi,
    Quote Originally Posted by Galichka View Post


    and changed the value 8 in your code to a.length;
    change 8 to 'c' so that,
    Java Code:
    for(int i=r-1;i>=0;i--)
            {
            	
            	
            	for(int j=(c-i);j<i;j++)  //'c' is nothing but a.length
            	{
            		a[i][j]=1;
            		
            	}
            	
            }
    will change every value from 2nd digit of the row into 1 in reverse direction starting from 8-c to c
    so it works for any array size

    regards
    dhilip
    Last edited by noobplus; 03-27-2012 at 04:43 PM.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. What are you using to write your code?
    By CaptainMorgan in forum New To Java
    Replies: 983
    Last Post: 03-26-2014, 10:12 AM
  2. Got the idea but cannot write in code... help me
    By u4722839 in forum New To Java
    Replies: 11
    Last Post: 09-09-2011, 03:33 AM
  3. Write XML-Code to console with SAX
    By enne87 in forum XML
    Replies: 6
    Last Post: 11-21-2010, 01:43 AM
  4. how do i write this code?
    By Libertyman in forum New To Java
    Replies: 23
    Last Post: 06-22-2010, 12:43 PM
  5. How To Write Unmaintainable Code
    By tim in forum Forum Lobby
    Replies: 2
    Last Post: 02-07-2010, 09:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •