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]
2 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]2 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
When Tim Berners-Lee developed the first specifications, protocols, and tools for the World Wide Web in 1993, his employers at C
Svetllana [295]

Answer:

c.

Explanation:

People trust open-source software - if they can see how it works and understand it, they can help improve it and build applications using it. If these protocols were not publicly available - then nobody would have implemented services using them - so nobody would be adopting it.

8 0
3 years ago
+
quester [9]

Answer:

Network administrator

5 0
3 years ago
Read 2 more answers
Which scenario would benefit most from being set up as a recurring appointment?
sveta [45]
The answer is b. Susan has an appointment with he co-worker on the first Monday of every month. This scenario would benefit from being set up as a recurring appointment, since it requires the same thing to be done every month on the same day. Susan is likely to forget this appointment every month, so a reminder like this would be useful for her. For the other cases, a recurring appointment would not be of much benefit since they do not follow a particular pattern time-wise.
3 0
3 years ago
Which item is used for formatting in responsive web design?
taurus [48]

Answer:

3) Improving image quality

Explanation:

A responsive web design is a web design that makes website to be user friendly to website users. It enables the users to have an optimal and enjoyable experience when making use of websites.

A responsive web design is the basis on which websites are built. It makes websites interactive for users such that that find the websites easy to access, easy to read and very interactive.

Computer programs used for creating a responsive web design are:

a) JavaScript

b) Cascading Style Sheets e.t.c

The item used for formatting a responsive web design is Improving Image quality. This helps to make the website responsive for users.

3 0
3 years ago
What is the basic process of programming?
NikAS [45]

Answer:

There are usually three stages to writing a program: Coding. Compiling. Debugging.

8 0
2 years ago
Other questions:
  • Search engines enable you to
    14·1 answer
  • What is an unique text-based internet address corresponding to a computer's unique numeric IP address called
    8·1 answer
  • What is the name of the program file that you can enter in the Windows search or Run box to execute Event Viewer? What process i
    12·1 answer
  • Brainliest for whoever adds me on snap<br> gianavaughn007
    15·2 answers
  • You can minimize the Ribbon with a command contained on the _____.
    7·1 answer
  • Consists of a variety of circuitry and components that are packaged together and connected directly to the motherboard. it perfo
    5·1 answer
  • Even if you cannot afford it you should donate at least 5 of your earnings to charity true or false
    8·1 answer
  • Characteristics of first generation computers​
    9·1 answer
  • Polynomial regression A common misconception is that linear regression can only be used to fit a linear relationship. We can fit
    11·1 answer
  • It's generally best to use what types of sites for factual internet research? Select all that apply from the choices below.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!