Write a program that accepts an integer array size as input. Loop through the array by its size and ask for an integer input to place in that index. If the input is lesser than or equal to zero, stop asking for input from the user, otherwise continue until the entire array is filled. Print the values inside the array such that they are enclosed in a pair of brackets [] with a comma that separates between each element. Input 1. One line containing an integer for the size of the array 2. Succeeding lines contain the elements of the array Output Enter-size: 10 Enter element 1: 1 Enter element 2: 2 Enter element 3: 3 Enter element 4: 4 Enter element 5: -5 Enter element 6: 6 Enter element 7: 7 Enter element 8: 8 Enter element 9: 9 Enter element 10: 10 [1,2,3,4,5,6,7,8,9,10]

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write a program that accepts an integer array size as input.
Loop through the array by its size and ask for an integer input to place in
that index.
If the input is lesser than or equal to zero, stop asking for input from the
user, otherwise continue until the entire array is filled.
Print the values inside the array such that they are enclosed in a pair of
brackets [] with a comma that separates between each element.
Input
1. One line containing an integer for the size of the array
2. Succeeding lines contain the elements of the array
Output
Enter size: 10
Enter element 1: 1
Enter element 2: 2
Enter element 3: 3
Enter element 4: 4
Enter element 5: 5
Enter element 6: 6
Enter element 7: 7
Enter element 8: 8
Enter element 9: 9
Enter element 10: 10
[1,2,3,4,5,6,7,8,9,10]
Transcribed Image Text:Write a program that accepts an integer array size as input. Loop through the array by its size and ask for an integer input to place in that index. If the input is lesser than or equal to zero, stop asking for input from the user, otherwise continue until the entire array is filled. Print the values inside the array such that they are enclosed in a pair of brackets [] with a comma that separates between each element. Input 1. One line containing an integer for the size of the array 2. Succeeding lines contain the elements of the array Output Enter size: 10 Enter element 1: 1 Enter element 2: 2 Enter element 3: 3 Enter element 4: 4 Enter element 5: 5 Enter element 6: 6 Enter element 7: 7 Enter element 8: 8 Enter element 9: 9 Enter element 10: 10 [1,2,3,4,5,6,7,8,9,10]
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY