Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java product 1 to n

public class Main {
  public static void main(String[] args) {
    var scanner = new java.util.Scanner(System.in);
    System.out.print("What is n? ");
    int n = scanner.nextInt();
    int product = 1;
    for (int i = 2; i <= n; ++i) {
      product *= i;
    }
    System.out.println("The product of 1..n is " + product);
  }
}
Comment

PREVIOUS NEXT
Code Example
Java :: dreamworks studio recent movies 
Java :: bouble to bytes[] java 
Java :: wat is voorbereiden voltooid deelwoord 
Java :: arraylist with values 
Java :: set html text android java 
Java :: appcompatdelegate.setdefaultnightmode(appcompatdelegate.mode_night_yes) not working 
Java :: protocollib onenable 
Java :: How to execute Shell Commands with Java and print the output directly while executing the command 
Java :: java swing get resource from image 
Java :: java load file from resources 
Java :: android studio constrainglayout 
Java :: Could not identify launch activity: Default Activity not found 
Java :: java get last element of list 
Java :: java key pressed 
Java :: how to encrypt a n image using java 
Java :: how to build a java main menu 
Java :: java how to center window 
Java :: how to byheart faster 
Java :: spring get bean with generic type 
Java :: java actionlistener 
Java :: apache dependency 
Java :: PlatformException (PlatformException(error, Neither user 10024 nor current process has android.permission.WAKE_LOCK., null, java.lang.SecurityException: Neither user 10024 nor current process has android.permission.WAKE_LOCK. 
Java :: java event enter key 
Java :: android studio get string 
Java :: java create inputstream from string 
Java :: android send parameters with intent 
Java :: Java Using forName() method 
Java :: get boolean from string java 
Java :: static and final in java 
Java :: array string remove element java 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =