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
uysha [10]
2 years ago
10

The user will input a three digit number

Computers and Technology
1 answer:
zlopas [31]2 years ago
5 0

import java.util.Scanner;

public class U1_L5_Activity_One {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("Please enter a two digit number: ");

int x = scan.nextInt();

System.out.println("Here are the digits:");

System.out.println(x/100);

System.out.println((x/10)%10); <em>//Just divide the result by 10 and find the remainder</em>

System.out.println(x%10);  

}

}

<em>//Or, you can do that way:</em>

<em />

import java.util.Scanner;

 

public class U1_L5_Activity_One {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

System.out.print("Please enter a two digit number: ");

String[] x = scan.nextLine().split(""); <em>//We need it to be a string array, to split the values after "", that is, after each symbol(number)</em>

System.out.println("Here are the digits:");

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

          System.out.println(Integer.parseInt(x[i])); <em>//Converting the string into int, as you want</em>

      }  

}

}

You might be interested in
Many contemporary languages allow two kinds of comments: one in which delimiters are used on both ends (multiple-line comments),
m_a_m_a [10]

Answer and Explanation:

Multiple-line comments :

Advantage :In the event that we need to remark out of zone of the given program , we can utilize it.

Disadvantage : In numerous line results are in reduced unwavering quality. It stretches out the remark as far as possible of the following comment.For least difficult approach to unintentionally leave off the last delimiter, which successfully expelling code from the program.

Single Line Comments :

Advantage :In the event that you need to close all the delimiter before close the program we utilize this kind of remarks.

Disadvantage : It put more burden on your program .It repeated on every line of a block of comments

3 0
3 years ago
What approach to dealing with deadlock does the wait-for graphs implement (prevention/avoidance/detection/ recovery)?
V125BC [204]
"detection" by checking for possible cycles or knots.
3 0
3 years ago
Jacob is preparing a presentation on the health and social advantages of taking up a sport at an early age. Most of the slides i
NARA [144]

Answer:

It's C

Explanation:

On edgenuity

4 0
3 years ago
Declare k, d, and s so that they can store an integer, a real number, and a small word (under 10 characters). Use these variable
Svetradugi [14.3K]

Answer:

int k;

double d;

char s[10];

cin >> k >> d >> s;

cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s;

Explanation

First Step (declare K, d, s) so they can store a integer

int k;

double d;

char s[10];

Second Step (read in an integer, a real number and a small word)

cin >> k >> d >> s;

Third Step ( print them out )

cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s;

5 0
3 years ago
What changes do you need to make to the algorithm to take as first input the numbers to be compared
Alenkinab [10]

Answer:

Explanation:

The constant function is useful in algorithm analysis, because it characterizes the number of steps needed to do a basic operation on a computer, like adding two numbers, assigning a value to some variable, or comparing two numbers. Executing one instruction a fixed number of times also needs constant time only.

6 0
3 years ago
Other questions:
  • A school librarian has been asked to identify inappropriate Internet usage. Which students would most likely be reported to the
    5·2 answers
  • An important task that the operating system performs is ____, which keeps track of the files stored on a computer so that they c
    15·1 answer
  • A program is considered portable if it . . . can be rewritten in a different programming language without losing its meaning. ca
    13·1 answer
  • Select the correct answer.
    8·2 answers
  • The purchase of one cup of coffee a day what's going to do
    15·2 answers
  • Henry went to an IT software company for an interview he was offered a position in lower level management which positions could
    11·1 answer
  • If a small monster collector:- Has 16 small monster containment devices and intends to use all of them.
    10·1 answer
  • . In testing, what is the role of an oracle?
    15·1 answer
  • How many bytes are there in 256 Kbytes?
    6·1 answer
  • What does it mean when someone says your voice doesn’t match how u look
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!