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
To use
sasho [114]

Answer:

Sticky notes

Explanation:

I got the question correct

7 0
3 years ago
Read the following Selection Sort function and determine the correct answer for blank #2.
lakkis [162]

Answer:

Option(a) is the correct answer to the given fill in the blank of #2

Explanation:

The values[indexOfMin] returns the minimum element in the particular array As in the given question we have to implement the selection sorting .In the selection sorting we have choose the element and compare them others minimum index that's why we have choose the values[indexOfMin] function.

  • The index of min is not the correct function So we have not used in the given fill in the blanks that's why option(b) is incorrect .
  • The  values[startIndex] represent the starting index only that is not suitable for the given question that's why it is incorrect option.

4 0
3 years ago
When was microsoft word for windows invented?
Dahasolnce [82]
1981 fue inventado por Bill gates y paul allen
4 0
3 years ago
Jason is the network manager and is leading a project to deploy a SAN. He is working with the vendor's support technician to pro
ikadub [295]

Answer:

Network diagrams.

Explanation:

In this scenario, Jason is the network manager and is leading a project to deploy a storage area network (SAN). He is working with the vendor's support technician to properly set up and configure the SAN on the network. To begin SAN input and output (I/O) optimization, Jason need to provide the network diagram to the vendor support technician.

A network diagram can be defined as a graphical representation of the topology of a network connection.

Basically, it gives an illustration of all the equipments such as routers, switches, hubs etc.

7 0
2 years ago
What is the least effective way to create balance and flow in your life?
ratelena [41]
<span>Act on your emotions in the moment instead of thinking about them. </span>
6 0
3 years ago
Other questions:
  • An analyst is reviewing the logs from the network and notices that there have been multiple attempts from the open wireless netw
    13·1 answer
  • This is important I need help please
    14·1 answer
  • What is the troubleshooting process?
    5·1 answer
  • The Next Einstein Initiative and the ________ Institute for Mathematical Sciences bring bright young learners and the best lectu
    7·1 answer
  • Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hou
    12·1 answer
  • A technician wants to consolidate and log specific alerts from network devices into a database so maintenance tasks and potentia
    11·1 answer
  • To print the number of elements in the array named ar, you can write :
    10·1 answer
  • How can the function abcfunc change the address in its local copy of intpoint?
    11·1 answer
  • Who put forward the idea of nanotechnology to the world?​
    6·1 answer
  • 1. Write a statement that opens the file Customers.dat as a random access file for both reading and writing.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!