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
Computer programming is an essential skill for anyone wishing to pursue a career in cybersecurity. What might be a good ""first
Jet001 [13]

Answer:

Python is the correct answer.

Explanation:

Python Programming Language is might be good for those programmers who are beginners because the following Language is quite easy and simple to learn. When any programmer using Python Language for the programming then, they easily write their program because of its simplicity, it is easy and quick for learning language. This language creates program easy and short.

3 0
3 years ago
¿En qué año se funda lego?
pochemuha
August 10, 1932 in Billund, Denmark
7 0
2 years ago
window operating system popularly known as. 1) character user interface. 2) computer user interface. 3) graphic user interface.
fredd [130]

Answer:

The window operating system is popularly known as a graphical user interface(GUI)

Explanation:

older operating systems were command line based but window uses a gui

5 0
3 years ago
Ethics issues are significant in the area of online privacy because laws have not kept pace with the growth of the Internet and
raketka [301]

Answer:

The answer is "True"

Explanation:

In the given statement some information is missing that is "True or false"

Internet security is the scope of the privacy and security of the electronic exchange of data. It's a common term that refers to something like many factors, technologies, and technology used to protect records, contact, and interests, confidential and private.

  • The security of the Internet is recognized as the privacy of the User.
  • It is secure and unique passphrases or two-factor authentication.
7 0
3 years ago
Whats the next lyric,i baked you a pie,pie,pie
eduard
“oh boy what flavor”
4 0
3 years ago
Read 2 more answers
Other questions:
  • Credibility means that the reader perceives value in what you write.<br> True False
    12·1 answer
  • Briefly explain five measures you have undertaken to protect your confidential
    12·1 answer
  • Write a paper, 2-3 paragraphs that discuss how to defend ideas objectively through effective communication. Include the skills n
    6·1 answer
  • In most software packages, the function key F1 is used to run the _____program.
    10·1 answer
  • Henry conducted a survey on an ad done by his company. In the survey, he asked people to evaluate the ad and state whether they
    8·1 answer
  • What is the component on the motherboard that confirms all devices are in working order once the computer is turned on?
    13·1 answer
  • What would be an ideal scenario for using edge computing solutions?
    10·1 answer
  • What necessarily happens when a photographer chooses to give either the aperture or the shutter speed priority?
    10·1 answer
  • Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.
    8·1 answer
  • Write Epic username plz
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!