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]
3 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]3 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
Draw a full binary tree of height 2. How many nodes does it have?
Paraphin [41]

Answer:

The number of nodes in a full binary tree of height 2 = 7

Explanation:

At each level k, of the full binary tree there are usually 2^{k} \\ nodes.

So the full binary tree of height 2 has nodes= 2^{0} \\ + 2^{1} \\ + 2^{2} \\.

which is 7.

6 0
4 years ago
What is better for a samsung tab a7 a 32 gb or 64
ad-work [718]

Answer:

I think 64 GB

Explanation:

64 GB would give you more ram and more storage which means you can get more apps or take more photos on there. 32 GB is good but you have to remember that system data takes up a significant amount of storage so you shouldn't get that. I'd say 64 GB would be the best.

5 0
3 years ago
Write an algorithm to sum to values
Elis [28]

Answer:

There is no need to make an algorithm for this simple problem. Just add the two numbers by storing in two different variables as follows:

Let a,b be two numbers.

c=a+b;

print(c);

But, if you want to find the sum of more numbers, you can use any loop like for, while or do-while as follows:

Let a be the variable where the input numbers are stored.

while(f==1)

{

printf(“Enter number”);

scanf(“Take number into the variable a”);

sum=sum+a;

printf(“Do you want to enter more numbers? 1 for yes, 0 for no”);

scanf(“Take the input into the variable f”);

}

print(Sum)

Explanation:

hi there answer is given mar me as brainliest

5 0
3 years ago
Suppose a program written in language L1 must be executed on a machine running a program running in language L0. What important
Whitepunk [10]

Question Completion with Options:

a. Translation of the entire L1 program into L0 code

b. Translation of the L0 program into L1 code

c. Creation of a language L3 that interprets L0 instructions

d. Interpretation of each L1 statement using L0 code as the L1 program is running.

Answer:

The important operations that must take place in this scenario are:

a. Translation of the entire L1 program into L0 code

d. Interpretation of each L1 statement using L0 code as the L1 program is running.

Explanation:

Translation enables decoding to take place.  This means that the L1 program is decoded into a language that the L0 program can understand and execute.  Without this translation, the higher level language of L1 will not be understood by the machine language of the L0 programs.  Translation of a code creates a shared understanding, thereby easing program execution.  Code translation is simultaneously accompanied by interpretation.

8 0
3 years ago
What would be the code of this in HTML ??
Alla [95]

Answer:r tHE RED LINE

Explanation:

Its not supost to be there

8 0
3 years ago
Other questions:
  • What key combination in excel takes you back to the first cell
    7·1 answer
  • Which of the following statements about these signs is true?
    13·1 answer
  • Tablets combine the features of which two types of devices?
    10·2 answers
  • Which feature of a blog allows an author to interact and get feedback from his or her readers?
    14·1 answer
  • Explain the significance of the loss of direct, hands-on access to business data that end users experienced with the advent of c
    14·1 answer
  • Write a function definition for a function which takes one parameter and returns twice that parameter
    12·1 answer
  • GMI = $4,666.67 Total Monthly Deductions $1,131.00 What is the Net Monthly Income (GMI - Total Monthly Deductions) =
    9·1 answer
  • The distance between two walls is called what?
    8·2 answers
  • What is the solution to the equation ?
    8·2 answers
  • In your opinion., which Zelda character is the hottest? Be honest.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!