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
Do software engineers save millions of dollars in usa
SCORPION-xisa [38]
Yes. They make a lot of money. So eventually after saving your Money, you will make a least 1 million dollars or more.
4 0
2 years ago
How long would it take a 8 bit computer to calculate π to the thousandth place?
allochka39001 [22]
The average speed of an 8 bit computer is 0.50 MIPS or million instructions per second. There are three  thousand instructions per digit of the number in <span>π, the thousandth place needs 4 x 3 = 12 thousand instructions. The time it takes to do this is 12000 / (0.5 x 1000) = 24 seconds.

</span>
7 0
3 years ago
Implement function hex2dec that takes a hex number hex_num as a string argument and prints out the corresponding decimal number.
DerKrebs [107]

Answer:

Check the explanation

Explanation:

#include <iostream>

using namespace std;

void hex2dec(string hex_num){

int n = 0;

//Loop through all characters in string

for(int i=0;i<hex_num.size();i++){

//take ith character

char c = hex_num[i];

//Check if c is digit

if(c>='0' && c<='9'){

n = 16*n + (c-48);

}

//Convert c to decimal

else{

n = 16*n + (c-55);

}

}

cout<<hex_num<<" : "<<n<<endl;

}

int main()

{

hex2dec("EF10");

hex2dec("AA");

return 0;

}

The Output can be seen below :

4 0
3 years ago
Assslainsdffddsvvdesdssbhasasco5m
alexandr402 [8]
Hahahahaha I wanna was the day I wanna was the last time I got to
8 0
2 years ago
Read 2 more answers
Which of the following is not one of the steps a company would take in an attempt to prevent a malfunction or failure of their p
bulgar [2K]

Answer:

A overdesign

Explanation:

7 0
2 years ago
Other questions:
  • You can use Facebook's live feed tool to broadcast content as you post it
    8·2 answers
  • Credit card numbers follow a standard system. For example, Visa, MasterCard, and Discpver Card all have 16 digits, and the first
    11·1 answer
  • The Chart below from Google Trends shows the prevelance of some search terms in the United States between 2004 and the present.
    8·1 answer
  • What would be the best engine to use for making a 3d beginner game
    9·1 answer
  • What is application software used for
    13·1 answer
  • What does it mean if my ninja blender power light is blinking?
    13·2 answers
  • Which function would you use to make sure all names are prepared for a mailing label? TODAY UPPER PROPER LOWER
    11·1 answer
  • List the two page orientations in Microsoft word​
    10·1 answer
  • What goes in between the &lt; &gt; when declaring a new ArrayList?
    14·1 answer
  • If you do not clean your hardware on a regular basis, which of these is most likely to be a problem?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!