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
What is this computer​
Salsk061 [2.6K]

Answer:

A Macintosh

Explanation:

6 0
3 years ago
On tablets and smartphones, what feature can be used that can erase the contents of the device if lost or stolen?
Artemon [7]
You could use the ADM website from a computer or any other device (that is not missing)
 <span />
4 0
3 years ago
A cell is the intersection of a row and a column, identified by a letter and number.
swat32

Answer: True

hello how are you

4 0
4 years ago
A circle is represented as a set of x and y coordinates of the screen pixel, where the shape of the circle is drawn, and an inte
Lilit [14]

Answer:

Answered below

Explanation:

//Program is written in Kotlin programming language

Class Circle(xCoordinate: Double, yCoordinate: Double, diameter: Int){

var coordinateX = xCoordinate

var coordinateY = yCoordinate

var circleDiameter = diameter

fun diffLocation(x1: Double, y1: Double){

coordinateX = x1

coordinateY = y1

print (coordinateX, coordinateY)

}

}

//Tester class

Class Main{

fun main( ){

val circle = Circle(2.34, 4.56, 10)

print(circle.coordinateX)

print (circle.coordinateY)

circle.diffLocation( 3.4, 2.8)

}

}

8 0
3 years ago
What space is space surrounding the area around the main subject.
makvit [3.9K]

Answer:

Positive space refers to the subject or areas of interest in an artwork, such as a person's face or figure in a portrait, the objects in a still life painting, or the trees in a landscape painting. Negative space is the background or the area that surrounds the subject of the work.

Explanation:

- The emptiness around and between the shapes or forms are called the negative spaces or ground. We often call it the background but it is more than that.

8 0
3 years ago
Other questions:
  • The _______ valve protects the air pump from reverse-exhaust pressure.
    11·1 answer
  • Headphones are an example of _____.
    6·2 answers
  • What is an administrator?
    8·1 answer
  • Amd relive how to download it says not fully installed help plz
    12·1 answer
  • What is the symbol for the relational operator 'equal to'?
    8·1 answer
  • A packet analyzer is a program that can enable a hacker to do all of the following EXCEPT ________. Select one: A. assume your i
    6·1 answer
  • /*
    8·1 answer
  • Explain the developement of modern technology?
    13·2 answers
  • Write a Scientific report modeling a written reasearch paper on big data applications.​
    6·1 answer
  • PLEASE ANSWER THIS ASAP‼️
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!