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 2 of 2

Thread: Whats wrong with my code?

  1. #1
    Junior Member
    Join Date
    May 2013
    Location
    Vietnam
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Whats wrong with my code?

    Hi !
    Please, help me for edit a Java program
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class Factorial {

    /**
    * Creates a new instance of <code>Factorial</code>.
    */
    public Factorial() {
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    // TODO code application logic here
    int a[];
    int gt = 1;
    int gthua, n;
    Scanner in = new Scanner(System.in);
    System.out.print("Added n to calculate factorial: ");
    n = in.nextInt();
    a = new int[n];

    for (int i = 1; i <= n ; i++){
    System.out.print("Input number : [" +i+ "]" );
    a[i] = in.nextInt();
    }
    for(int i = 1; i <= n; i++){
    gt = gt * i;
    }
    gthua = gt;
    System.out.print("Sum of the series " + n +" is :"+gthua);


    }
    }

    //This progarm Java Wrong, please edit for right


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Whats wrong with my code?

    Please do not hijack an existing thread with a question all your own. Your post has been moved to a new thread.
    Also please see the Announcements page for the use of code tags when posting code to the forum.
    Last but not least, if you have an actual question, please post that too. We do not just fix things for you, rather we offer advice as you fix it yourself.

Similar Threads

  1. Can anyone see whats wrong with this code
    By javapol in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 27th, 2013, 03:59 PM
  2. help me with a code, whats wrong?
    By Heizzer10 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 17th, 2012, 11:30 AM
  3. Whats wrong with this code????
    By westberge in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 10th, 2012, 07:49 PM
  4. whats wrong with my code.
    By jove in forum Object Oriented Programming
    Replies: 3
    Last Post: July 30th, 2011, 11:45 PM
  5. Whats Wrong with this code?
    By whattheeff in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 9th, 2011, 10:59 PM