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]
4 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]4 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 the name of the "local user" account involved in the alleged actions (Hint: where in the file structure did you find the
Sunny_sXe [5.5K]

I will assume this is a windows computer

Answer:

  • Disk (Letter)\Users\<"Answer">\Folder\Documents\SuspiciousFile.exe
  • You can use Windows Security Logs to try and find out from what IP address the user you just found logged in from.

Explanation:

The windows user folder has folders that contain each users data, Using the file path of the suspicious file you can figure out which user is associated with the file.

Windows Security Logs collect data on logon attempts so when the user logs in their IP address should be collected in these log files.

8 0
3 years ago
What type of address is the ip address 198.162.12.254/24?
grigory [225]
<span>The IP address 198.162.12.254/24 is a </span>Unicast address.
4 0
3 years ago
Problem You Need to Solve for This Lab:
Paraphin [41]

Answer:

Write questions properly

Explanation:

Then it is easy to say answer

4 0
3 years ago
Which of these methods returns a random number?
Olenka [21]
D randgenerator
i just need 20 characters

6 0
3 years ago
Which type of software is primarily used to organize a collection of information for easy access?Which type of software is prima
MaRussiya [10]

Answer:

database - you could also use a spreadsheet but you can't ask questions that you can with a database

Explanation:

8 0
4 years ago
Other questions:
  • What is a good monitor for console gaming? (Any price)
    13·2 answers
  • How to type in color on clash royale
    15·2 answers
  • Splunk In most production environments, _______ will be used as the source of data input?
    12·1 answer
  • What are some situations where you might find it useful to use the “!” symbol in a program?
    9·1 answer
  • what is the goal of technology A. to understand how the natural world functions B. to study the natural world C. to improve the
    9·1 answer
  • You should not define a class field that is dependent upon the values of other class fields: Group of answer choices In order to
    14·1 answer
  • Which of the following is Microsoft’s fastest, most efficient operating system to date: a. Offering quicker application start up
    14·1 answer
  • Your classmate is frustrated because the code that was designed to add up her five quiz grades is not working properly.
    12·1 answer
  • Explain the working principle of computer with suitable diagram​
    15·1 answer
  • Who Invented Abacus!
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!