Results 1 to 2 of 2

Thread: Leading zeros

  1. #1
    MoralesWard is offline Senior Member
    Join Date
    Dec 2009
    Posts
    176
    Rep Power
    3

    Default Leading zeros

    I am BSc(I.T) student. In last lecture sir give one assignment on java. In that assignment there is one program. The program is like write java program to add leading zeros to a number. I tried different way but not any of them work out. Can anybody help me to resolve this program?
    Thanks in advanced.
    Last edited by MoralesWard; 02-06-2010 at 03:58 PM.

  2. #2
    JenkinsReed is offline Senior Member
    Join Date
    Dec 2009
    Posts
    169
    Rep Power
    3

    Default

    According to me following is the very easy program to add leading zeros to a number. You have to just set that value into one variable then you have to transfer it another variable. After this you have to use append() method to do this.

    String addZeross(Sting a)
    {
    int b=0;
    k=a.length();
    if ( b = 10 )
    return c;
    else
    {
    int d= 10 - b;
    for (int k=0; b<=c; d++)
    {c="0"+c;}
    return c;
    }
    Last edited by nitesh14; 02-06-2010 at 03:03 PM.

Similar Threads

  1. EU proclaimed IBM mistreated its leading market in mainframe PCs
    By Sharon Bernard in forum Latest Hardware News
    Replies: 0
    Last Post: 07-26-2010, 03:55 PM
  2. Changing Leading in Word Documents
    By GonzalezBrown in forum Software Jargons
    Replies: 0
    Last Post: 01-20-2010, 02:51 PM
  3. Super Talent Launches Industry-leading CFast Storage Card
    By gorden in forum Latest Hardware News
    Replies: 0
    Last Post: 12-04-2009, 07:06 AM
  4. Adding Leading zeros in excel 2007
    By Bratton Clovelly in forum Programming
    Replies: 0
    Last Post: 07-25-2009, 09:46 AM
  5. AMD is leading in performance
    By Gabriel Watson in forum Latest Hardware News
    Replies: 0
    Last Post: 06-26-2009, 06:28 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48