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]
2 years ago
14

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

Computers and Technology
1 answer:
Harman [31]2 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
The loop function is similar to range(), but handles the parameters somewhat differently: it takes in 3 parameters: the starting
nexus9112 [7]

Answer and Explanation:

def loop(start, stop, step):

   return_string = ""

   if step == 0:

       step = 1

   if start > stop:  # the bug was here, fixed it

       step = abs(step) * -1

   else:

       step = abs(step)

   for count in range(start, stop, step):

       return_string += str(count) + " "

   return return_string.strip()

5 0
3 years ago
Explain how power surges can affect computers and how this problem can be minimised or removed<br>​
Crank

Answer:

It places electrical pressure on the wires in your computer, causing them to heat up and burn. Some wires may melt and even if your computer survives the surge, the strain alone can cause damage in the long run. A way to minimize a power surge is to use a surge protector.

6 0
2 years ago
Why do you think that so many of these sources have similar names?
Anon25 [30]

Answer:

What sources? WILL ANSWER in comments

4 0
3 years ago
Why are there so many unit testing tools? Are they efficient? Why or why not?
sineoko [7]

Answer:

 Unit testing is the software testing method in which the individual source code are associate to control data. Unit testing basically test the code to ensure that the data or information meets its design.

The aim of unit testing that each part isolate in the program and display the correct individual parts.

Unit testing tool are efficient as they provide several benefits in the development cycle. The basic efficiency of unit testing tools depend upon its type of testing. Unit testing basically validate the units of source code in the program.

For example: when the loop and function in the program work efficiently.

5 0
2 years ago
Which of these printers would be the most suitable for printing a large number of high quality black and white printouts?
Alex777 [14]

Answer:

A laser pointer

Explanation:

A laser printer would be the most suitable printer for printing a large number of high quality black and white printouts

8 0
3 years ago
Other questions:
  • Cleo finds herself frequently searching for messages from particular senders or with specific subjects. What should she create
    5·1 answer
  • You want to plug a keyboard into the back of a computer. you know that you need to plug the keyboard cable into a ps/2 port. whi
    9·1 answer
  • Monetary Policy can be either Expansionary or Contractionary. Which of the following actions classify as Expansionary Monetary P
    7·2 answers
  • An iPad Is An Example Of Which Type Of Computer?
    11·2 answers
  • A USB zipper drive is a small data storage device that plugs into a computer's USB port.
    14·1 answer
  • _____ is the widely used transport layer protocol that most Internet applications use with Internet Protocol (IP).
    9·1 answer
  • What is the internet ?
    11·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    11·1 answer
  • Ethan is coding in Python and trying to add a set of numbers including both floats and integers. What should he do to make sure
    12·1 answer
  •  A programming paradigm is a method used to program a computer that guides the solving of a problem or performing of a task. Whi
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!