solve using c program

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

solve using c program

The crazy mad Dr. 1Nito aka "Dark One" has made in
a break though in research for his treasure finder
device.
"Are you all crazy? How can they use this one? I want
to make this simple and clear. Just find this 6 and this
will all be done."
As one of the loyal apprentices please help Dr. 1Nito
complete his research.
Objective 1: Transform the given code to use pointer
arithmetic instead of array subscripting/manipulation
Objective 2: Simplifying the for-loop condition
without using compound statement removing the 2nd
condition in the second for loop.
Objective 3: Must still be able to get the first
occurrence of 6.
Note: The code is already correct. Make sure to
transform it the way Dr. 1Nito want it based on the
objective.
Sample Output
How long is the series? 5
Input number 1: 9
Input number 2: 9
Input number 3: 9
Input number 4: 6
Input number 5: 9
First occurence of 6 is element 4
1
2
3
4 void main() {
456N
7
8
9
ANAANGASASHENG
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#define MAX 50
25
26 }
int series [MAX] = {0};
int *pSeries = series;
int count;
int i;
int loc;
printf("How long is the series? ");
scanf("%d", &count);
//First for loop.
for(i=0; i<count; i++) {
}
printf("Input number %d: ", i+1);
scanf("%d", &series[i]);
//Second for loop
for (i=0; i<count && series[i]!=6; i++) {}
loc = i == count? -1: i+1;
printf("First occurence of 6 is element %d", loc);
Transcribed Image Text:The crazy mad Dr. 1Nito aka "Dark One" has made in a break though in research for his treasure finder device. "Are you all crazy? How can they use this one? I want to make this simple and clear. Just find this 6 and this will all be done." As one of the loyal apprentices please help Dr. 1Nito complete his research. Objective 1: Transform the given code to use pointer arithmetic instead of array subscripting/manipulation Objective 2: Simplifying the for-loop condition without using compound statement removing the 2nd condition in the second for loop. Objective 3: Must still be able to get the first occurrence of 6. Note: The code is already correct. Make sure to transform it the way Dr. 1Nito want it based on the objective. Sample Output How long is the series? 5 Input number 1: 9 Input number 2: 9 Input number 3: 9 Input number 4: 6 Input number 5: 9 First occurence of 6 is element 4 1 2 3 4 void main() { 456N 7 8 9 ANAANGASASHENG 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include <stdio.h> #define MAX 50 25 26 } int series [MAX] = {0}; int *pSeries = series; int count; int i; int loc; printf("How long is the series? "); scanf("%d", &count); //First for loop. for(i=0; i<count; i++) { } printf("Input number %d: ", i+1); scanf("%d", &series[i]); //Second for loop for (i=0; i<count && series[i]!=6; i++) {} loc = i == count? -1: i+1; printf("First occurence of 6 is element %d", loc);
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

in the ouput

how long is the series? 2

Input number 1: 9
Input number 1: 9

First occurrence of 6 is element 10

 

how to make the output

First occurrence of 6 is element -1 ?

 

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Binary numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education