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
Alinara [238K]
4 years ago
7

python Consider this data sequence: "3 11 5 5 5 2 4 6 6 7 3 -8". Any value that is the same as the immediately preceding value i

s considered a CONSECUTIVE DUPLICATE. In this example, there are three such consecutive duplicates: the 2nd and 3rd 5s and the second 6. Note that the last 3 is not a consecutive duplicate because it was preceded by a 7. Write some code that uses a loop to read such a sequence of non-negative integers, terminated by a negative number. When the code finishes executing, the number of consecutive duplicates encountered is printed. In this case,3 would be printed. ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input.
Computers and Technology
1 answer:
Vika [28.1K]4 years ago
7 0

int firstNumber,secondNumber = -1, duplicates = 0;

do {

cin >> firstNumber;

if ( secondNumber == -1) {

secondNumber = firstNumber;

}else {

if ( secondNumber == firstNumber )

duplicates++;

else

secondNumber = firstNumber;

}

} while(firstNumber > 0 );

cout << duplicates;

You might be interested in
7.3 A hydraulic lift has a mechanical advantage of 6. If the load weighs 780 N, calculate
Zielflug [23.3K]

Answer:

Effort = 120 Newton

Explanation:

Given the following data;

Mechanical advantage = 6

Load = 780 N

To find the effort required to lift the weight;

Mechanical advantage can be defined as the ratio of the load (weight) lifted by a simple machine to the effort (force) applied.

Mathematically, the mechanical advantage is given by the formula;

M.A = \frac {Load}{Effort}

Making effort the subject of formula;

Effort = \frac {Load}{M.A}

Substituting into the formula, we have;

Effort = \frac {720}{6}

Effort = 120 Newton.

3 0
3 years ago
Select the correct answer from each drop-down menu. What skills should Tara hone to get a job in testing? Tara is a recent compu
Karo-lina-s [1.5K]
What’re the choices?
6 0
3 years ago
Who like anime becus i dooooo ( wrote this becuse i forgot what i was writing abot)
mars1129 [50]

Answer:

My bestie loves Animes...... I don't watch anime But good at drawing anime(◠‿◕)

4 0
3 years ago
Top Down Design makes it easier to solve a problem by:___________
vaieri [72.5K]

Answer:

c) Starting with the biggest function and then moving to smaller ones

Explanation:

This design is a breakdown of a structure to determine the text functionality for small parts. The system analyzes the built-in top-down style, which defines and does not define some first-level components, often referred to as an unstable layout.

so correct answer is c) Starting with the biggest function and then moving to smaller ones

4 0
3 years ago
What other kinds of toolbars exist in addition to those that are part of individual programs?
Stells [14]
<span>A. toolbars that appear on the taskbar

</span><span>D. the process of allocating uses and resources for a server</span>
6 0
4 years ago
Other questions:
  • What does nat stand for? network access trigger network administration timetable network address translation network association
    13·1 answer
  • When creating a mail merge, you must insert all of the items from your data source into your merged document. Truth or false ?
    6·2 answers
  • Mrs. Brown is a teacher at the elementary school. As the school year begins, she sends a couple of email messages to her student
    11·1 answer
  • How do ACLs work on a router?
    14·1 answer
  • Techniques that shape material without removing material.​
    6·1 answer
  • What is difference between augmented reality and mixed reality?​
    11·1 answer
  • Ask what are brainly points for besides asking questions.
    9·1 answer
  • Write a program that demonstrates the class by creating a Payroll object, then asking the user to enter the data for an employee
    8·1 answer
  • Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smalle
    12·1 answer
  • This class is missing a number of functions. Rewrite the class declaration to follow best practices, e.g, operators, three impor
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!