1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nasty-shy [4]
3 years ago
7

Create another method: getFactorial(int num) that calculates a Product of same numbers, that Sum does for summing them up. (1,2,

3 ... num) Make sure you use FOR loop in it, and make sure that you pass a number such as 4, or 5, or 6, or 7 that you get from a Scanner, and then send it as a parameter while calling getFactorial(...) method from main().
Computers and Technology
1 answer:
Mandarinka [93]3 years ago
3 0

Answer:

The program in Java is as follows;

import java.util.*;

public class Main{

public static int getFactorial(int num){

    int fact = 1;

    for(int i =1;i<=num;i++){

        fact*=i;

    }

    return fact;

}

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 System.out.print("Number: ");

 int num = input.nextInt();  

 System.out.println(num+"! = "+getFactorial(num)); }}

Explanation:

The method begins here

public static int getFactorial(int num){

This initializes the factorial to 1

    int fact = 1;

This iterates through each digit of the number

    for(int i =1;i<=num;i++){

Each of the digits are then multiplied together

        fact*=i;     }

This returns the calculated factorial

    return fact; }

The main begins here

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

This prompts the user for number

 System.out.print("Number: ");

This gets input from the user

 int num = input.nextInt();  

This passes the number to the function and also print the factorial

 System.out.println(num+"! = "+getFactorial(num)); }}

You might be interested in
Whats important about the points?
likoan [24]
You can earn ranks! That is important.
8 0
3 years ago
Read 2 more answers
What is the difference between algorithm and flowchart​
Tomtit [17]
Flowchart - diagram created by different shapes to show flow of data
algorithm - step by step procedure to solve the problem

A flowchart is a representation of an algorithm
5 0
3 years ago
fill down feature on a formula and you need to keep a cell reference the same which one will allow you to keep the same cell ref
dedylja [7]
A dollar sign after both the letter and the number for each cell reference you want to keep the same will keep it the same when using the fill down/across function.
6 0
3 years ago
Place the steps in order for inserting an index in a document.
tester [92]

Answer:

Steps to insert an index in a document

Explanation:

  1. open the document
  2. click on the <u>references</u> tab either above or below the document
  3. click the <u>mark entry</u> button
  4. select a word or group of words for the index
  5. click on the <u>mark entry</u> dialogue box
  6. format the page numbers in your index
  7. format the text for your index entry
  8. click <u>mark</u>
  9. click <u>mark all</u>
7 0
3 years ago
Read 2 more answers
__________ states that network connection speeds for high-end users will increase by 50 percent per year, enabling new companies
Liula [17]

Answer:

Nielsens law

Explanation:

4 0
1 year ago
Other questions:
  • In computer logic what is order of instructions
    13·1 answer
  • A _________ is automatically launched by some trigger and appears in front of the active window
    12·1 answer
  • write a script that creates and calls a stored procedure named insert_category. first, code a statement that creates a procedure
    10·1 answer
  • Match these step-by-step directions in the order that you will find them in this course.
    9·1 answer
  • Device driver:<br> System software or application software
    11·2 answers
  • Describe the process of sorting the following list using the above algorithm:
    7·1 answer
  • Anyone know what this is pls help
    11·1 answer
  • O Why was the Internet originally constructed? Oto enable researchers to communicate
    6·2 answers
  • Fill in the blanks:<br>Can anyone help me out with this <br>​
    9·1 answer
  • A keyboard would be considered _____. Select 2 options.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!