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
bezimeni [28]
3 years ago
13

1. Implement a method factorial(int n), that takes a number (int) and returns its factorial. Factorial of an integer is the prod

uct of all positive integers less than or equal to it. Method needs to be implemented using recursion.
Computers and Technology
1 answer:
marysya [2.9K]3 years ago
6 0

Answer:

import java.io.*;

import java.util.*;

public class Main

{

public static int factorial(int n){

if (n == 0)

return 1;    

else

return(n * factorial(n-1)); //recursively calling factorial function

}

public static void fibbonaci(int n)

{

if(n>0)

{

c=a+b; //next term in series

a=b;

b=c;

System.out.print(" "+c);    

fibbonaci(n-1); //recursively calling fibbonaci function

}

}

static int a=0,b=1,c;

  public static void main(String[] args) {

  int list_num,fact;

      List<Integer> num=Arrays.asList(1,3,5,7,9); //arraylist with 1,3,5,7,9

      for(Integer i:num) //for-each loop

      {    

      a=0;

      b=1;

      list_num=i.intValue();

      System.out.println("Fibbonaci series for "+list_num);

      System.out.print(a+" "+b);

      fibbonaci(list_num-2); //calling fibbonaci for values in list

      fact=factorial(list_num); //calling factorial for values in list

      System.out.println();

      System.out.println("Factorial for "+list_num+" is "+fact);

      System.out.println();

     

      }

  }

}

You might be interested in
Winners announced tomorrow when I check results ngl I gtg to sleep soon I should see a lot of people tomorrow ^^
kobusy [5.1K]

i am sup by the way. so im guessing i win?

4 0
3 years ago
Pa help please I need help<br>10 points :'(<br>nonsense report:<br>1 heart​
tatuchka [14]

Answer:

√ 1. Cellphone

<h3>Product Description:</h3>

A cellphone is any portable telephone that uses cellular network technology to make and receive calls.

7 0
2 years ago
Scrieți un program care citește un număr natural n și determină suma cifrelor divizibile cu 3 ale lui n.
Vika [28.1K]
Sorry I don't understand your question
5 0
3 years ago
Which tools allows you to see the edition, version and memory use by windows 10?
cricket20 [7]

Answer:

Resource Monitor

Performance Monitor

Computer Management and Administrative Tools

Advanced User Accounts Tool

Disk Cleanup

Local Group Policy Editor

There is alot do u want them all?

6 0
3 years ago
An e-commerce company is collaborating with artisans from all over the world to sell the artisans' products. Accenture is helpin
satela [25.4K]

Accenture is helping this client build a platform that will allow them to interact with the e-commerce company and get details of the buyer so they can target to a specific audience.

<h3>What is Blockchain Digital identity?</h3>

The term Digital identity is a tool that helps firm in terms of growth and viability of a lot of their digital economy, and it is needed by every organization.

Therefore, we can say that  Accenture is helping this client build a platform that will allow them to interact with the e-commerce company and get details of the buyer so they can target to a specific audience.

See options below

connect them with the customers, enhance their marketing, and build their client base

link them with the banks to prove credit-worthiness and inform them of loan options

individually recognize and reward them for using methods and materials that align with buyers' values such as sustainability and labor practices

allow them to interact with the e-commerce company and get details of the buyer target to a specific audience

I don't know this yet

Learn more about Accenture from

brainly.com/question/25682883

#SPJ1

5 0
2 years ago
Other questions:
  • Select the correct statement(s) regarding digital baseband modulation.
    7·1 answer
  • 5. Create a variety of test cases focusing on the sorting algorithm, such as the final element is the smallest, the entire set i
    8·1 answer
  • A restaurant has a case type that allows customer to book the dining room for events. Customers provide basic information includ
    7·1 answer
  • An application needs to calculate sales tax for purchases. You decide to simplify the code by putting the sales tax calculation
    9·1 answer
  • Out of the following, find those identifiers, which cannot be used for naming Variables, Constants or Functions in a python prog
    11·1 answer
  • What is the difference between head header and heading in HTML​
    8·1 answer
  • Travis just got promoted to network administrator after the previous administrator left rather abruptly. There are three new hir
    14·1 answer
  • 31
    10·1 answer
  • Write the definition of a function that evaluates three double numbers and returns true if the floor of the product of the first
    8·1 answer
  • Who plays Pokemon Go if you do put your code in your answer so I can friend you.<br><br><br> o_o
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!