Question: c programming ORK-AREA RESULTS Consider this data sequence: 3 11 5 5 5 2 4 6 6 7 3-8. Any value that is the same

 c programming ORK-AREA RESULTS Consider this data sequence: "3 11 5

5 5 2 4 6 6 7 3-8". Any value that is

c programming

ORK-AREA RESULTS 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 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 exits the loop it should print the number of consecutive duplicates encountered. In the above case, that value would be 3. SUBMIT > 5 of 5. 2021-02-12 18:35:55 1 #include 3 4 int main() 5 { 6 int num1, num2, count; 7 num2 = 0, count = 0; 8 9 // Prompt the user to enter the first number. 10 printf("Enter the numbers: "); 11 scanf("%d", &numi); 12 13 while((num1>-1) && (num2>-1)) 14 { 15 7/Prompt the user to enter the second number. 16 scanf("%d", &num2); if(numl == num2) 18 { 19 count++; 20 } 21 num1 = num2; 22 } 23 //Display the number of duplicates. printf("Number of duplicates are: "); 26 printf("%d", count); 27 return 0; WORK AREA RESULTS CODELAB ANALYSIS: LOGICAL ERROR(S) More Hints: I haven't yet seen a correct solution that uses: main I haven't yet seen a correct solution that uses: return Want More Hints? Click here Problems Detected: The contents of your standard output is incorrect. Given the following was entered from the keyboard: 1.1.1-1.1.1--1 you displayed: instead of: 5 TEST CASE TABLE ? Testing with these values... results in keyboard display The contents of your standard output is incorrect. Given the following was entered from the keyboard: 1-2-1-2-1-2-1-2--1 you displayed #1 x 1 2 1 2 1 2 1 2 -1 instead of: 0 The contents of your standard output is incorrect. Given the following was entered from the keyboard: 1-1-2-2-3-6--1 you displayed: #2 1 1 2 2 3 3 -1 instead of: B Show More

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!