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}. 324758.2040686.qx3zqy7

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 23SA
icon
Related questions
Question
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}. 324758.2040686.qx3zgy7 1 #include <stdio.h> 2 3 int main(void) { const int NUM_GUESSES = 3; int userGuesses[NUM_GUESSES]; int i; 4 7 8 * Your solution goes here */ 9 for (i = 0; i < NUM_GUESSES; ++i) { printf("%d ". } 10 11 userGuesses[i]); 12 13 14 return 0; 15

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}.
324758.2040686.qx3zqy7
1 #include <stdio.h>
2
3 int main(void) {
const int NUM_GUESSES = 3;
int userGuesses[NUM_GUESSES];
int i;
4
5
6
7
8
V* Your solution goes here */
9
for (i = 0; i < NUM_GUESSES; ++i) {
printf("%d ", userGuesses[i]);
}
10
11
12
13
14
return 0;
15 }
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}. 324758.2040686.qx3zqy7 1 #include <stdio.h> 2 3 int main(void) { const int NUM_GUESSES = 3; int userGuesses[NUM_GUESSES]; int i; 4 5 6 7 8 V* Your solution goes here */ 9 for (i = 0; i < NUM_GUESSES; ++i) { printf("%d ", userGuesses[i]); } 10 11 12 13 14 return 0; 15 }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT