1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mestny [16]
2 years ago
15

Write a while (or for) statement to print all the digits of an int type variable x, one digit per line. For example, if int x

Computers and Technology
1 answer:
Vlada [557]2 years ago
7 0

<em>Complete Question:</em>

<em>Write a while (or for) statement to print all the digits of an int type variable x, one digit per line For example, if int x 38625, then the output should be in 5 lines as 60 (Hint: You may use built-in method to get a String representation of x then print out each character in String)</em>

***** Java *****

Answer:

import java.util.*;

public class Main{  

public static void main(String args[])  {  

Scanner input = new Scanner(System.in);

System.out.print("Enter an integer: ");

int x = input.nextInt();

String str = Integer.toString(x);  

for(int i =0;i<str.length();i++)  {

    System.out.println(str.charAt(i));

}

}  

}  

Explanation:

This line prompts user for input

System.out.print("Enter an integer: ");

This line gets user input

int x = input.nextInt();

This line converts user input to string

String str = Integer.toString(x);  

The following loop iterates through the converted string

for(int i =0;i<str.length();i++)  {

This prints each character on the string

    System.out.println(str.charAt(i));

}

You might be interested in
When the location of a data source is defined as a(n) _______ location, excel will access the connection to the data source with
valina [46]

trusted is your answer

5 0
3 years ago
Resolution has the most impact on the size of photo print you can make.
siniylev [52]
If you want the best possible print, you need to upload the best quality digital file. Sometimes photos might look just fine when you look at them on your computer screen, and you might wonder what’s up with us when we say we can’t print them. Photos that don’t have sufficient resolution will look all blurry and pixilated (blocky with jagged edges) when printed.
3 0
3 years ago
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject afte
SCORPION-xisa [38]

Changing a worksheet name in Microsoft Excel can be done in multiple ways, but only one of them is correctly explained in the provided option, which is (A) double-click both the worksheet tabs one at a time and then enter the new names.

The other options are incorrect. Even though you can change a worksheet’s name by right-clicking the sheet name, you also need to choose the appropriate option from the window bar that would appear – which is, of course, the rename option.

5 0
3 years ago
Read 2 more answers
Assignment RequirementsYou have been working as a technology associate in the information systems department at Corporation Tech
garik1379 [7]

Answer:

hola me llamos por mi nombre

Explanation:

me gusta la tegnologia

y no e trabajado xq soy estudiamte aun

7 0
3 years ago
. Differentiate between Radio waves and Microwaves
ankoles [38]
Well you listen to a radio and you put food in a microwave
7 0
3 years ago
Other questions:
  • Which of the following is not an algorithm?
    8·1 answer
  • Your friends know that you understand a lot about computers, both the technical details of how they operate as well as informati
    12·1 answer
  • Match the items.
    15·1 answer
  • By using password-stealing software, ________ capture what is typed on a keyboard and easily obtain enough personal information.
    5·1 answer
  • 2. Name the type of product the United States used to<br> first enter the arena of technology.
    9·1 answer
  • You are creating a presentation and you have come to the last slide. You still have more information to add. What should you do?
    7·1 answer
  • Consider a multidimensional array A stored in row-major order with 22 rows and 6 columns whose subscripts start at 0. If each el
    8·1 answer
  • Explain why the process of sketching in engineering might resemble a loop or a cycle.
    15·2 answers
  • If I bought mine craft p.e. for 7.99 and hook my Micro soft account up, will i get java edition
    11·1 answer
  • T/F static development is the process of constructing the programs and code modules that serve as the building blocks of the inf
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!