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
Which directory service software would be used exclusively on a windows network?.
SSSSS [86.1K]

The directory service software that would be used exclusively on a windows network is AD, an active directory service. The correct option is c.

<h3>What is directory service software?</h3>

A directory service is a group of programs and procedures that keep records of data about your business, subscribers, or both.

Microsoft created AD, a directory service solution, specifically for Windows. It offers a user interface for managing shared network objects, including users, user groups, desktop and laptop computers, devices, printers, and services.

Therefore, the correct option is c, Active Directory.

To learn more about directory service software, refer to the link:

brainly.com/question/28110834

#SPJ1

The question is incomplete. Your most probably complete question is given below:

Lightweight Directory Access Protocol (LDAP)

Novell Directory Services (NDS)

Active Directory

Acyclic-Graph Directory Structure

7 0
1 year ago
Unscramble the following words and write them correctly in the
seropon [69]

Answer:

1. icie?

2. formula

3. function

4. column

Explanation:

I'm not sure about #1.

5 0
3 years ago
Hubs hardware advantage's and disadvantages​
marin [14]

Answer:

answer in picture

hope it's helpful

6 0
3 years ago
Help! Will add the brainliest.
geniusboy [140]

Answer:

b

Explanation:

8 0
3 years ago
Read 2 more answers
Blank is a type of drag and drop code to help beginner
lana [24]

Answer:

Scratch

Explanation:

7 0
3 years ago
Other questions:
  • One governing factor when determining the minimum size of conduit to be used is the 
    9·2 answers
  • Which of the following is NOT a logical operator (logical connective)?
    5·1 answer
  • Select the correct answer. Which sentence best describe an effective management strategy? A. Conceal game-related clippings prio
    12·2 answers
  • . What are the typical parts of a Change Request Document?
    6·1 answer
  • How can cultural hearths be described
    5·1 answer
  • What allows user to double click with the mouse in a document to move the insertion point to a new location.?
    8·1 answer
  • . Here is a sequence of addresses during execution of some program: 4, 16, 0, 20, 52, 68, 172, 64 Assuming a fully associative c
    8·1 answer
  • Complete the PizzaCaloriesPerSlice() function to compute the calories for a single slice of pizza. A PizzaCalories() function re
    6·1 answer
  • What are the core components of a computer system?
    14·1 answer
  • One of the users in your company is asking if he can install an app on his company-provided mobile device. The installation of a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!