Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: very basic program

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default very basic program

    write a program to determine the sum of the following harmonic series for a given value of n:
    1+1/2+1/3+.............................+1/n
    the value of n should be given interactively through the keyboard.

    plz help me.
    actually i am learning java so please help me to learn this.
    thanks in advance
    mamta


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: very basic program

    What have you tried?
    One problem will be with integer math: 1/2 = 0
    vs floating point math: 1.0/2 = 0.5
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    13
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: very basic program

    You need to know at least these things below to write that program:
    1) Know how to prompt user to input value
    2) Know how to use loop
    3) Know the difference between integer and double.

Similar Threads

  1. Basic program help
    By Newguy1 in forum Object Oriented Programming
    Replies: 4
    Last Post: October 13th, 2013, 10:25 PM
  2. basic program + ms sql db
    By selomojemalo in forum JDBC & Databases
    Replies: 0
    Last Post: August 4th, 2013, 01:30 PM
  3. need help with this basic program containing loops
    By kingslayer in forum Loops & Control Statements
    Replies: 2
    Last Post: March 23rd, 2012, 06:54 PM
  4. BASIC program help
    By ryanquanz in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 15th, 2011, 10:42 AM