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
Can someone tell me how to fix the keyboard on ipad?- its in the middle of my screen andd i dont know how to do it
mamaluj [8]

Answer:

Here

Explanation:

To move keyboard to bottom of screen, you just need to tap and hold the keyboard icon at the bottom-right corner of the keyboard, choose Dock option. To fix iPad keyboard in middle of screen, please tap and hold the keyboard icon, then choose Dock.Nov 5, 2020

5 0
3 years ago
What is true of softboxes?
gizmo_the_mogwai [7]
Softboxes have an umbrella on the front. The answer to your question is A. I hope that this is the answer that you were looking for and it has helped you.
4 0
3 years ago
Read 2 more answers
What is technology and how does it work?
Yuki888 [10]
Technology is what we use today to access internet and social media!!!
8 0
3 years ago
Write a program to solve the selection problem. Let k = N/2. Draw a table showing the running time of your program for various v
Brums [2.3K]
So here is the code in Python:

n = 0.00 #this is a float because there are some numbers that are decimals.

while n < 20: #n which is 0.00 and while it is lower than 20 if runs the code below
n = n + 1 #it will add 1 to n everything it runs the code.
k = n / 2 #it will divide whatever n is everytime by 2
print(str(n) + '/2: ') # it's printing the number it's on
print(k) # prints the answer for the n.

You can change n to add by any, make n any num instead of 0.00 and you can change the while condition from n < 20 to any other logical statement. If you want to get creative you can take 2 inputs for numbers and make one of them the starting number and other one is the ending number. Also make sure to make n a number lower than you starting point because if you set n as your starting point then it will skip it.

4 0
3 years ago
The =COUNT function calculates what value?
Natalka [10]

c is the anwer of question

4 0
3 years ago
Read 2 more answers
Other questions:
  • What is the primary purpose for a screen saver in windows?
    8·1 answer
  • What is the service provided by a third party (such as an ISP) that enables you to connect another cloud directly to your Google
    15·1 answer
  • Amazon.com uses a customer profiling system whenever a customer visits its website. using this system, amazon can offer products
    6·1 answer
  • The following is a sequence of undo-log records written by two transactions T and U: &lt; START T&gt;; ; &lt; START U&gt;; ; ; ;
    8·1 answer
  • In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors m
    5·1 answer
  • Which spreadsheet toolbar displays options such as Cut and Paste?
    11·2 answers
  • Question # 2
    7·1 answer
  • Ivan wants to have code in a game that will make it possible to change the speed of a swimmer in the game. Which of these does I
    8·1 answer
  • 6. The following is a dump of a DATA chunk in hexadecimal format. 00000015 00000005 0003000A 00000000 48656C6C 6F000000 a. Is th
    7·1 answer
  • Why do my airpods keep disconnecting from my laptop
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!