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 expense is a bank least likely to extend a line of credit for?
m_a_m_a [10]

The answer would be:

A flat-screen TV.

7 0
3 years ago
Read 2 more answers
Do anyone else receive random points from Brainly… because I swear I had like 2K+ something and I check and Im at ACE… and with
sergiy2304 [10]

Answer:

i had the same thing happen to me and no it doesnt make sense at all but....i found something out a while ago...

Explanation:

they have achievements and it helps with how you earn points and level up

6 0
3 years ago
Prompt the user for an automobile service. Each service type is composed of two strings. Output the user's input. (1 pt) Ex: Ent
Svet_ta [14]

Answer:

Required code is given below.

Best Regards,

Please ask if any queries.

Explanation:

#include <stdio.h>

#include <string.h>

int main(void)

{

  char input[100];

  printf("Enter desired auto service:\n");

  scanf ("%[^\n]%*c", input);

  printf("You entered: %s\n",input);

  if(strcmp(input,"Oil change") == 0){

     printf("Cost of oil change: $35\n");

  }

  else if(strcmp(input,"Tire rotation") == 0){

     printf("Cost of tire rotation: $19\n");

  }

  else if(strcmp(input,"Car wash") == 0){

     printf("Cost of car wash: $7\n");

  }

  else{

      printf("Error: Requested service is not recognized\n");

  }

   

  return 0;

}

8 0
3 years ago
The Freeze Panes feature would be most helpful for which situation?
sergiy2304 [10]

Answer:

i think a but not so sure

Explanation:

6 0
3 years ago
Which of the following is productivity strategy for collaboration?
mixer [17]

Which of the following is a productivity strategy for collaboration?

  • A. Saving focused work for a time of day when you feel most creative.
  • B. Employing the 80/20 rule to prioritize tasks.
  • C. Posting files to a web-based shared site.
  • D. Using white noise to block distractions in the office.

<u>Answer:</u>

Posting files to a web-based shared site is a productivity strategy for collaboration.

  • C. Posting files to a web-based shared site.

<u>Explanation:</u>

Collaborative software or groupware is application programming intended to help individuals taking a shot at a typical errand to achieve their objectives. This permits individual to impart thoughts and their abilities to different individuals with the goal that the assignment can be done both proficiently and adequately.

Joint effort stages ordinarily incorporate an email customer, Web conferencing, internet based life sharing, video capacities, report sharing abilities, texting and that's just the beginning. Endeavor joint effort stages are intended to be introduced on-premises or conveyed by means of the Web as cloud-based administrations.

8 0
3 years ago
Other questions:
  • Which type of wireless network is<br> controlled through a wireless<br> access point?
    7·1 answer
  • Which ipv6 prefix will the typical enterprise network receive from the service provider?
    12·1 answer
  • Tom is the aerobics coordinator at a fitness center. He needs a more efficient way for his instructors to share information. Cla
    13·2 answers
  • How to Create a while loop
    6·2 answers
  • Click on the _____ tab on the ribbon to open the backstage view.
    7·1 answer
  • Always follow the routine "clean up while in use and clean up before keeping it".
    6·1 answer
  • What is the best way to improve an online search?
    11·2 answers
  • Five plus six is equal to?​
    10·2 answers
  • HELP THIS IS SO DIFFICULT
    10·2 answers
  • Cybersecurity is defined as the set of techniques to protect the secrecy, integrity, and availability of computer systems and da
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!