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
Rama09 [41]
3 years ago
12

I need to create a function that returns Pascal's Triangle with n rows, where n is an int argument.

Computers and Technology
1 answer:
Ede4ka [16]3 years ago
6 0

A function that returns Pascal's Triangle with n rows:

//import necessary headers

public class Pascal_Triangle {

   // calculate factorial  

   static int factorial(int n)

   {

       int fact = 1;

       int i;

       for(i=1; i<n; i++)

       {

           fact*=i;

       }

       return i;

   }

   // Actual code to display the //pascal triangle

   static void display(int n)  

   {

       int i;

       int line;

       for(line=1;line<=n;line++)

       {

           for(i=0;i<=line;i++)

           {

               System.out.print((factorial(line)/factorial(line-i) * factorial(i)) + " ");

           }

           System.out.println();

       }

   }

   // To read user input

   public static void main(String[] args){  

       BufferedReader breader=new BufferedReader(new InputStreamReader(System.in));

       int n;

       System.out.println("Enter the size for creating Pascal triangle");

       try {

           n = Integer.parseInt(breader.readLine());

       }

       catch(Exception e){

           System.out.println("Please enter a valid Input");

           return;

       }

       System.out.println("The Pascal's Triangle is");

       display(n);

   }

}

You might be interested in
A(n) __________ is a popular way to describe relationships? (i.e., one-to-one,? one-to-many) in a relational database.
Leto [7]
A link is a popular way to describe relationships in a relational database.
There are three types of relationships (links) between tables:
1. One-to-one <span>relationship , that allows only one record on each side of the relationship.
2. </span>One-to-many <span>relationship, that allows a single record in one table to be related to multiple records in another table.
3. </span>Many-to-many<span> relationship, in which many records in a table can link to many records in another table. F</span>
6 0
3 years ago
Your manager asks you to get details on a computer crash. What Windows Administration Tool could you use?
Law Incorporation [45]
  • The answer is "Option C" because the WMD is a freeware memory test software that works excellently.
  • It is a comprehensive math question, and it is also quite straightforward to use.
  • They suggest that you first test your ram with Memtest86, but you really should always test a second time with a different memory testing application to be certain.
  • Microsoft Windows Diagnostic is the second tool, that scans your laptop's physical memory & identifies any faults.
  • It requires a reboot to be used the system that will restart, and you'll be unable to your mouse in the Memory Diagnostic Tool.

The wrong choices can be defined as follows:

  • In option a, it is wrong because the data warehouse transforms data into information that may be used by an organization's decision-making process.
  • In option b, it is wrong because by using Metrics Collector Groups and logging the data, it was able to display real-time market data as well as collect and store data.
  • In option d, it is wrong because this is a tool used in Windows, which displays detailed information about major events that have taken place on your machine.
  • In option e, it is wrong because messages and trace logs could be viewed and sorted using the Log Viewer.

Learn more:

Memory Diagnostic: brainly.com/question/13606234

3 0
3 years ago
Read 2 more answers
Which of the following behaviors is considered ethical?
kolezko [41]

Answer:

answer is c. using a limited access public computer to watch movies

7 0
2 years ago
Read 2 more answers
What word is used today to refer to network-connected hardware devices?.
lions [1.4K]
Th answer to your question is Endpoint
5 0
2 years ago
5. Smart watch can provide us with the ability to get
masya89 [10]

Answer:

uh yea that is true

Explanation:

3 0
3 years ago
Other questions:
  • Choose all statements that identify the benefits of programming design.
    10·2 answers
  • What can you do to stop a computer from repeatedly restarting in a continuous loop?
    13·1 answer
  • А.<br> is the highest education degree available at a community college.
    6·1 answer
  • Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
    12·1 answer
  • Online banking tools allow you to pay bills from your computer. <br> a. True<br> b. False
    5·2 answers
  • Which of these might be an example of an advertiser's target group?
    12·2 answers
  • What is gained by increasing the ritation speed of a disk or cd?​
    9·1 answer
  • What is computer code?<br> A. Java Script<br> B. XML<br> C. HTML<br> D. Any programming language
    6·1 answer
  • Search the Web for three different employee hiring and termination policies. Review each and look carefully for inconsistencies.
    5·1 answer
  • Which of the following statements is TRUE? A. A name error occurs if the variable is referenced before it is declared. B. A name
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!