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
olga55 [171]
3 years ago
14

Write a program in c++ to displaypascal’s triangle?

Computers and Technology
1 answer:
Harman [31]3 years ago
7 0

<u> C++ Program to Print Pascal's Triangle</u>

 #include<iostream> //header file

using namespace std;

//driver function  

int main()

{

   int r;/*declaring r for Number of rows*/

   cout << "Enter the number of rows : ";

   cin >> r;

   cout << endl;

 

   for (int a = 0; a < r; a++)

   {

       int value = 1;

       for (int b = 1; b < (r - a); b++) /*Printing the indentation space*/

       {

           cout << "   ";

       }

       for (int c = 0; c <= a; c++) /*Finding value of binomial coefficient*/

       {

           cout << "      " << value;

           value = value * (a - c) / (c + 1);

       }

       cout << endl << endl;

   }

   cout << endl;

   return 0;

}

<u>Output</u>

<u>Enter the number of rows :  5</u>

                 1

              1      1

           1      2      1

        1      3      3      1

     1      4      6      4      1

You might be interested in
Dim Inventory() as Integer = {357, 126, 220}Call Stock(Inventory(2),Me.lblOutput)Sub Stock (ByVal Number As Integer, ByRef lblLa
aalyn [17]

Answer:

The answer is "Option c".

Explanation:

In the given visual basic code, an integer array "Inventory" is declared, that includes 3 elements, that are "357, 126, and 220". In the next line, a call stock function is used, in the function, the array is passed as a parameter and in array parameter, the index value that is "2" is passed. This function use label to print array index value, that is "220". and other options are incorrect that can be described as follows:

  • Option a and Option b both are wrong because array indexing always starts with 0 and ends with n-1, and in this array, it will take index value 2, which is not equal to 357 and 126.

6 0
3 years ago
2. Suppose you want to write a method that prints a heading on a new output page, along with a page number that is 1 in the firs
Ilia_Sergeevich [38]

Answer:

This can be done in both Java and C#, using a static (or class) data member for the page number.

Explanation:

7 0
3 years ago
What permissions are needed in order to use a work online that is in the public domain?
Maurinko [17]
<h2 /><h2>⇒Written  \: permission  \: from \\  the  \: creator</h2>

The term “public domain” refers to creative materials that are not protected by intellectual property laws such as copyright, trademark, or patent laws. ... Anyone can use a public domain work without obtaining permission, but no one can ever own it.

5 0
3 years ago
Hello there!I have a Macbook Air and by accident I had put my finger on the screen and made a small white dot.
Mnenie [13.5K]
Dont worry happens to my sisters laptop once. You just have to wait it out.
It wont damage your computer. It means that your laptop is also sensetive so dont touch the screen with too much force.
Hope I helped you!
7 0
4 years ago
Read 2 more answers
Which of the following team members are involved in transporting goods directly to customers?
olganol [36]

Answer:

Dave is a regular shopper at Colric Inc., an online company that sells T-shirts. He placed an order for five T-shirts, however when the order arrived, Dave discovered the T-shirts were defective. He returned the order and requested replacements from Colric. This scenario shows an exception to which aspect of a supply chain?

3 0
3 years ago
Other questions:
  • James was having coffee and overhead a conversation between two men who talked about the fact that their friend could not find a
    10·1 answer
  • Define the acronym WAECUP and its components
    15·1 answer
  • 5. How is shutter speed generally measured? What do the measurements mean?
    7·2 answers
  • When a formula includes a cell reference, Excel interprets that cell reference as being located relative to the position of the
    13·1 answer
  • The formula =B2/A2 is inserted into cell C2. Which of the following is true when this formula is copied and pasted into cell C3?
    6·1 answer
  • What is the name of the top-level parentless folder in a digital file system?
    8·1 answer
  • The design of a blog refers to:
    8·1 answer
  • Three Cat 5e cables were run from an office area to three computers in a machine shop. Work took place on the weekend when the m
    14·1 answer
  • It is not really important to organize your photos because you know that they are on your computer. (TRUE/FALSE)
    10·2 answers
  • Most jobs in computer disciplines require which minimum level of education?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!