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
zavuch27 [327]
3 years ago
6

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 is consi

dered 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. That is, stdin = new Scanner(System.in); is given.
Computers and Technology
1 answer:
Darya [45]3 years ago
3 0

// Variable to keep track of array size

int length = 0;

// Array itself

int array[] = {};

// while loop will take input in the array until a negative number is entered

while(input>=0){

stdin = new Scanner(System.in);

array[length] = stdin;

length +=1;

}

// int variable to terminate while loop

int i =0;

// keep track of index of output array

int y =0;

while(arr[i] != length){

// making output array

int output[]={}; bool flag;

// put the element in out put array considering if it the desired one

output[y] = array [i];

// Now check if it was the desired?

for(int z=1;z<=length;z++){

if(array[i+z]!=output[y]){

 flag = true;

}

else

{

 output[y]=0;

 y+=1;

}

if(array[i+z+1]=output[y] && flag == true){

output[y] = array[i];

y+=1;

}

}

//output the array

for(int o=0;o<y;o++)

System.out.println(output[o];

You might be interested in
What is folded card publishing?​
Alexeev081 [22]

Answer:

Folded card This layout type is for creating greeting cards by printing pages on a sheet and then folding the sheet to make the card. If you choose the Folded card layout, then sheet fold options are displayed. Select an option in the list to specify how you will fold your publication

Explanation:

3 0
2 years ago
Read 2 more answers
Which best compares appointments and events in Outlook 2010
lesantik [10]

In Microsoft Outlook, there are differences between appointment and event. Appointment is defined as <em>an activity that you schedule in your calendar which does not involve other people.</em> Appointments can be scheduled to a certain duration in a day. Event is defined as <em>an activity that you do with other people which lasts from 24 hours to longer. </em>

Thus, from these descriptions, the best answer to the question is (C) appointments have a start and end time of day, and events do not.

5 0
3 years ago
Write the definition of a function dashedline, with one parameter , an int . if the parameter is negative or zero, the function
GalinKa [24]
Static void DashedLine(int n){     if (n>1) Console.WriteLine(new String('-', n));}
5 0
3 years ago
Why is image compression an important part of vidoetechnology?
OLEGan [10]

Answer: Image compression is the technique which is responsible for the reduction in the size of the image according to the need of the video technology. Image compression is done because of the following reasons:-

  • Makes more space for the storage and creates space.
  • It also reduces the time that is used up for the uploading of the video through internet.
  • Text, labels etc might also be needed to inserted along with the image .

4 0
3 years ago
Which of the following represents something businesses do to keep the integrity and security of their company data?
iren [92.7K]
I’m not sure but if I wouod have to answer it would be 2 or 3
6 0
2 years ago
Other questions:
  • Please help with this
    5·2 answers
  • Why do so many people think the revision stage is the hardest
    13·2 answers
  • If in your checkout cart right before you buy something there is an option saying "this order contains a gift." on amazon, what
    7·1 answer
  • How does the Rights Management Services feature help to protect information
    11·1 answer
  • The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
    15·1 answer
  • Find the simple interest Jay owes on a five-year student loan of $48,000 with an annual interest rate of 5%.
    6·1 answer
  • Explain an application software​
    9·1 answer
  • What is the family access code right now?
    5·1 answer
  • Where is the BIOS stored?<br><br> CPU<br> CMOS<br> RAM<br> Northbridge
    13·2 answers
  • Which of the following items can you locate in a document using the navigation pane? Choose the answer.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!