
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
thumb_up100%
my code is producing no output.
![Write a for loop to populate array userGuesses with NUM_GUESSES integers. Read integers using scanf. Ex: If NUM_GUESSES is 3
and user enters 9 5 2, then userGuesses is {9, 5, 2}.
Code writing challenge activity demo
449096.3145616.qx3zqy7
1 #include <stdio.h>
2
3 int main(void) {
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18}
const int NUM_GUESSES = 3;
int userGuesses [NUM_GUESSES];
int i;
scanf("%d",
for (i = 0; i < userGuesses[i] ; ++i){
scanf("%d", userGuesses [i]);
}
for (i = 0; i < NUM_GUESSES; ++i) {
printf("%d ", userGuesses [i]);
}
return 0;](https://content.bartleby.com/qna-images/question/29052707-d338-419d-afe4-6fb918a87d58/e7737fc5-0845-4c6c-aeda-8990ebf13873/6efa3uf_thumbnail.png)
Transcribed Image Text:Write a for loop to populate array userGuesses with NUM_GUESSES integers. Read integers using scanf. Ex: If NUM_GUESSES is 3
and user enters 9 5 2, then userGuesses is {9, 5, 2}.
Code writing challenge activity demo
449096.3145616.qx3zqy7
1 #include <stdio.h>
2
3 int main(void) {
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18}
const int NUM_GUESSES = 3;
int userGuesses [NUM_GUESSES];
int i;
scanf("%d",
for (i = 0; i < userGuesses[i] ; ++i){
scanf("%d", userGuesses [i]);
}
for (i = 0; i < NUM_GUESSES; ++i) {
printf("%d ", userGuesses [i]);
}
return 0;
Expert Solution

arrow_forward
Step 1
Algorithm:
1. Create a constant 'NUM_GUESSES' and set it to 3.
2. Create an array 'userGuesses' that can hold 3 elements.
3. Prompt the user to enter 3 integers.
4. Using a for loop, scan the entered integers and store them in the array.
5. Print the entered numbers stored in the array.
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
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.Similar questions
- So l am trying to use a prompt which asks a user for their name and when the user enters a name it proceeds to another prompt but when the user doesn't enter anything it loops back to the first prompt which is ask for the users name. If the user enters a valid input it then goes to the program prompt where if the user enters any input it proceeds but if the user doesn't it loops to the same prompt I want to use the while loop for thisarrow_forwardCan you use Python programming language to wirte this code? Thank you very much!arrow_forwardThe following Little Man program is supposed to add two numbers, subtract a third input number from the sum, and output the result. Result = (Input 1 + Input 2) - Input 3 Mailbox Code 00 901 01 399 02 901 03 199 04 399 05 901 06 299 07 902 08 000 What is wrong with the program? Modify the program so that it produces the correct resultarrow_forward
- Which type(s) of loop would be best to run a weather model for 1000 cycles? A do-while loop A for loop A while loop Either a do-while loop or a while loop Either a for loop or a while loop Either a do-while loop, for loop or a while looparrow_forwardSuppose you wrote a program that you suspect contains an infinite loop because it keeps running for several minutes with no output and without ending. What would you add to your program to help you discover the origin of the problem?arrow_forwardHi, I wrote the code from this question, but I am unable to input anything and get an output for it. Would you please be able to help me change the code in order to be able to run the code and be able to input the specific things in the question and get the right output? Thank you. Question: Dan’s recently announced that he’s teaching n top-secret courses next semester. Instead of enrolling in them through ACORN, students need to email Dan to express their interests. These courses are numbered from 1 to n in some arbitrary order. In particular, if a student named s is interested in taking a course c, they need to send an email to Dan containing the message c s. Note that if a student is interested in taking multiple courses, they need to send multiple emails, one per course. Uponreceivingamessagec s,Danlooksatthelistofstudentsalreadyenrolledin course c. If there’s already a student on the list whose name is too similar to s, Dan assumes s is the same student and ignores the…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education