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]
3 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]3 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
____________________deals with syntax and semantics ofinformation exchange.
Goshia [24]

Answer:

The answer is (a).Presentation Layer

Explanation:

This layer is located at the 6th level of the OSI model, responsible for delivering and formatting the information to the upper layer for further processing. This service is needed because different types of computer uses different data representation. The presentation layer handles issues related to data presentation and transport, including encryption,translation and compression.

3 0
3 years ago
A user saves a password on a website the user logs into from a desktop. Under which circumstances will the password be saved on
artcher [175]

Answer:

same encryption certificate

Explanation:

only logical xD

4 0
3 years ago
What is an icon or animation used to represent aparticipant in an internet chat referred to as?
Veronika [31]
Emoji is an icon or animation used to represent a participant in an internet chat.
8 0
3 years ago
Which feature of the basic input/output system (bios)/unified extensible firmware interface (uefi) would you enable if you wante
Paraphin [41]

The answer should be secure boot

5 0
3 years ago
Question 2 of 10
Minchanka [31]

True because it depends

7 0
3 years ago
Other questions:
  • 3. Megan and her brother Marco have a side business where they shop at flea markets, garage sales, and estate
    9·1 answer
  • Which Internet resource can you use to publicly describe an adventure trip you recently made?
    9·1 answer
  • are designed to locate information based on the nature and meaning of Web content, not simple keyword matches Select one: a. Cra
    14·1 answer
  • You need to access the registry on your windows 10 computer how do you do this
    9·1 answer
  • What would be the best engine to use for making a 3d beginner game
    9·1 answer
  • Thomas drew a rectangle with an area of 6 square cm what is the greatest possible perimeter of this rectangle
    5·1 answer
  • Discuss copyright issues as they relate to the Internet, including software piracy and digital rights management, and the Digita
    14·1 answer
  • Need the answer ASAP!!!
    5·1 answer
  • Bonjour ma question est: expliquer comment fonctionne une calculatrice qui ne contient pas une pile. Pouvez-vous m'aider?
    12·1 answer
  • Are programs that understand physics and/or hardware embedded? for example, one that uses finite-element methods to predict flui
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!