
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
Write a for loop that prints: 1 2 … countNum
Ex: If the input is:
4
the output is:
1 2 3 4
![Write a for loop that prints: 1 2 ... countNum
Ex: If the input is:
4
the output is:
1 2 3 4
1 import java.util.Scanner;
2
3 public class For Loops {
4 public static void main (String[] args) {
5
6
7
8
9
10
11
12
13
14
15}
int countNum;
int i;
Scanner input = new Scanner(System.in);
countNum = input.nextInt();
for Your code goes here */) {
System.out.print(i + " ");](https://content.bartleby.com/qna-images/question/1c870776-4927-4fbd-b218-f5b27740c439/8b4c1110-a385-4375-b37d-0bd5732926ab/hqbndnl_thumbnail.png)
Transcribed Image Text:Write a for loop that prints: 1 2 ... countNum
Ex: If the input is:
4
the output is:
1 2 3 4
1 import java.util.Scanner;
2
3 public class For Loops {
4 public static void main (String[] args) {
5
6
7
8
9
10
11
12
13
14
15}
int countNum;
int i;
Scanner input = new Scanner(System.in);
countNum = input.nextInt();
for Your code goes here */) {
System.out.print(i + " ");
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Write code that prints: firstNumber … 2 1
Print a newline after each number.
Ex: If the input is:
3
the output is:
3 2 1
![Write code that prints: firstNumber... 2 1
Print a newline after each number.
Ex: If the input is:
3
the output is:
3
2
1
java.util.Scanner;
3 public class For Loops {
1 import
HNM4 in 8096
2
5
6
7
public static void main (string[] args) {
int firstNumber;
int i;
10
11
12
13
14 }
15}
PREB
Scanner input = new Scanner(System.in);
firstNumber = input.nextInt();
for Your code goes here */) {
System.out.println(i);](https://content.bartleby.com/qna-images/question/1c870776-4927-4fbd-b218-f5b27740c439/44a5f3a8-f859-44b9-be1f-66e652842516/geitdfb_thumbnail.png)
Transcribed Image Text:Write code that prints: firstNumber... 2 1
Print a newline after each number.
Ex: If the input is:
3
the output is:
3
2
1
java.util.Scanner;
3 public class For Loops {
1 import
HNM4 in 8096
2
5
6
7
public static void main (string[] args) {
int firstNumber;
int i;
10
11
12
13
14 }
15}
PREB
Scanner input = new Scanner(System.in);
firstNumber = input.nextInt();
for Your code goes here */) {
System.out.println(i);
Solution
by Bartleby Expert
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Write code that prints: firstNumber … 2 1
Print a newline after each number.
Ex: If the input is:
3
the output is:
3 2 1
![Write code that prints: firstNumber... 2 1
Print a newline after each number.
Ex: If the input is:
3
the output is:
3
2
1
java.util.Scanner;
3 public class For Loops {
1 import
HNM4 in 8096
2
5
6
7
public static void main (string[] args) {
int firstNumber;
int i;
10
11
12
13
14 }
15}
PREB
Scanner input = new Scanner(System.in);
firstNumber = input.nextInt();
for Your code goes here */) {
System.out.println(i);](https://content.bartleby.com/qna-images/question/1c870776-4927-4fbd-b218-f5b27740c439/44a5f3a8-f859-44b9-be1f-66e652842516/geitdfb_thumbnail.png)
Transcribed Image Text:Write code that prints: firstNumber... 2 1
Print a newline after each number.
Ex: If the input is:
3
the output is:
3
2
1
java.util.Scanner;
3 public class For Loops {
1 import
HNM4 in 8096
2
5
6
7
public static void main (string[] args) {
int firstNumber;
int i;
10
11
12
13
14 }
15}
PREB
Scanner input = new Scanner(System.in);
firstNumber = input.nextInt();
for Your code goes here */) {
System.out.println(i);
Solution
by Bartleby Expert
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
- Thanks in advance. Python language.arrow_forwardFor the following input, how many times will the for loop iterate? 7 -1 -3 -5 -14 -15 -20 -40arrow_forwardWrite a program using do-while loop that: Asks the user to enter a number between 0 and 99 (inclusive). If the number is not valid, then it should continue asking the user for a valid numbr If the number entered is valid, then use a for loop to print a countdown from the number entered down to 0.arrow_forward
- Convert the following for loop into do-while loop : for(int c =11; c>=0; c-=2) System.out.printIn("Count: "+ c);arrow_forwardfor a in range(5,17,3): How many times the loop statement will run?arrow_forwardWrite a while loop that prints the multiples of 3 from 300 down to 3. The programming language is java.arrow_forward
- Construct a single for loop to print out the following lines. You may use as many variables as you wish, but you may not use multiple loops. 4 4 4 8 2 7 16 1 10 32 0.5 13 64 0.25 16arrow_forward3. Out of the given loops, which loop/s will execute infinitely. a. for(; true; ) b. for(; false;) c. for(; 2==2; )arrow_forwardIn python, Write a for loop that iterates through numbers from 1 to 10, adds them up together, and prints the total. The printed output should be 55.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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