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
What two devices in a computer should be considered "black boxes," and should never be opened due to risks involving charged cap
NNADVOKAT [17]

The two devices in a computer that should be considered "black boxes," and should never be opened due to risks involving charged capacitors are MONITOR and POWER SUPPLY.

Explanation:

  • Physical contact or close proximity to the open power supply caused a discharge from the capacitor that resulted in an electric shock. Capacitors can discharge current even when not energized because they hold a charge for some time after the power is turned off.
  • To do harm to your body, the voltage across the capacitor's terminals must be high enough to cause a harmful effect on you. There are no hard rules for at what voltage things become harmful, but a common 'rule of thumb' is that DC up to 48 Volt is considered low voltage. So a capacitor charged to a voltage below 48 V is fairly safe.
  • A charged capacitor can be very dangerous, so it's important that you avoid coming into contact with the terminals at all times.
3 0
3 years ago
Contrast the following terms (provide examples): Partial dependency; transitive dependency
kiruha [24]

Answer:

Explanation:

Transitive dependency

In this case, we have three fields, where field 2 depends on field 1, and field three depends on field 2.

For example:

Date of birth --> age --> vote

Partial dependency

It is a partial functional dependency if the removal of any attribute Y from X, and the dependency always is valid

For example:

Course and student these tables have a partial dependency, but if we have the field registration date, this date will depend on the course and student completely, we must create another table with the field registration date to remove this complete dependency.

If we remove or update the table registration date, neither course nor student must not change.

5 0
3 years ago
If myClass has a constructor with a parameter of type String, select the other constructor that should be included.
JulijaS [17]

Answer:

d. public myClass( ) {. . .}

Explanation:

A constructor is a special method that is called when an object of a class is created. It is also used to initialize the instance variables of the given class. A class may have one or more constructors provided that these constructors have different signatures. A class that does not have a constructor explicitly defined has a default parameterless constructor.

Having said these about a constructor, a few other things are worth to be noted by a constructor.

i. In Java, a constructor has the same name as the name of its class.

For example, in the given class <em>myClass</em>, the constructor(s) should also have the name <em>myClass</em>.

ii. A constructor does not have a return value. It is therefore wrong to write a constructor like this:

<em>public void myClass(){...}</em>

This makes option a incorrect.

iii. When a constructor with parameters is defined, the default parameterless constructor is overridden. This might break the code if some other parts  of the program depend on this constructor. So it is advisable to always explicitly write the default parameterless constructor.

This makes option d a correct option.

Other options b and c may also be correct but there is no additional information in the question to help establish or justify that.

7 0
3 years ago
TRUE/FALSE QUESTIONS: T F 1. An intruder can also be referred to as a hacker or cracker. T F 2. Activists are either individuals
Law Incorporation [45]

Answer:

1. True 2. False 3. True 4. True 5. True 6. False 7. True

Explanation:

1.  A hacker/cracker finds and exploits weakness in order to gain access with a criminal intent, just as an intruder.

2. Activists are people who campaign to bring about a positive political or social change.

3. It is illegal to use a device as a packet sniffer to steal people's usernames and passwords.

4. This quite true, as there is a huge community of hackers where people are highly recognized for hacking.

5. Yes, intruders have a common attack methodology.

6. IDS monitors networks or systems to identify suspicious activities while a user interface is the means the computer and the user interacts. So it's false.

7. instrusion detection involves monitoring networks or systems to identify suspicious activities, so an intruder is detected if their behavior is suspicious when compared to a legitimate user.

5 0
3 years ago
Attacking systems by exploiting otherwise unknown and unpatched vulnerabilities is also known as:
Nostrana [21]

Answer:

Zero-day exploits

Explanation:

Zero-day exploits refers to recently found vulnerabilities in a computer software program that has been in existence but was hitherto not known and addressed by the software security experts, however, these vulnerabilities were known to hackers. While the existence of these "loop-holes" in the software can go on unnoticed for several years, hackers can take advantage of it to cause harm to the computers' programs and data.

When these attacks occur, it is called a zero-day because the attack took place on the very day that the loop-hole was discovered in the software. So exploitation has already taken place before a fix is carried out.

5 0
3 years ago
Other questions:
  • When an Ethernet frame arrives at a computer, the Ethernet layer must hand the packet that it contains to the next higher layer
    9·1 answer
  • Write an examples of Output device, storage devices and inputs device 10 each excluding the common ones​
    5·1 answer
  • A database interrogation is a major benefit of the database management approach, where end users can query (“ask”) the database
    6·1 answer
  • An educational institution has a number of buildings in the campus. Each building has its own independent network system, and al
    6·2 answers
  • What is the full word of"VPN"?​
    15·2 answers
  • 1. in terms of technology, we often said to be living in the _____ age.???
    15·2 answers
  • One form of online vandalism is ____ operations, which interfere with or disrupt systems to protest the operations, policies, or
    9·2 answers
  • Debug the recursive reverseString method, which is intended to return the input String str reversed (i.e. the same characters bu
    13·1 answer
  • Lesson 3 - Calling All Operators
    6·1 answer
  • The lower band and upper band of integer data type​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!