Input a double and print the first two digits after the decimal point with a space between them. Sample run: Please input a decimal number: 57.8934 Answer: 8 9 Hint - to complete the second coding activity in lesson 5 you had to learn how to get individual digits from an int value. You can reuse this method once you convert the user input to an appropriate int value (you will need both multiplication and casting for this).

Answers

Answer 1

Answer:

number = float(input("Please input a decimal number: "))

number = int (number * 100)

second_digit = number % 10

first_digit = int(number / 10) % 10

print("Answer: " + str(first_digit) + " " + str(second_digit))

Explanation:

Ask the user to enter a decimal number (number = 57.8934)

Multiply it by 100 (number = 5789.34) and typecast to int (number = 5789)

Use the module to get the second digit (9)

Divide the number by 10 (578.9), typecast to int (578) and use module operator to get the first digit (8)

Print the numbers as requested

Answer 2

The code is:

int main(){

double n;

int v, d;

scanf("%lf\n", &n);

n = n*10;

v = (int)n;

d = v%10;

printf("The first digit is %d\n", d);

n = n*10;

v = (int)n;

d = v%10;

printf("The second digit is %d\n", d);

return 0;

}

----------------------

To get each decimal digit, we multiply by 10 until the digit, then calculate the remainder of the operation(mod) of the integer part relative to 10.For example:

57.8934 x 10 = 578.934

The integer part is 578.

The remainder of the division of 578 by 10 is 8.

Now, we have to generalize it, thus:

int main(){

double n;

int v, d;

scanf("%lf\n", &n); -> Reads the double;

/*First digit*/

n = n*10; -> Multiplies by 10.

v = (int)n; -> Casts the integer part

d = v%10; 0 -> Remainder relative to 10 to get the first digit.

printf("The first digit is %d\n", d);

/*Second digit -> Does the same thing*/

n = n*10; -> Multiplies by 10.

v = (int)n; -> Casts the integer part

d = v%10; 0 -> Remainder relative to 10 to get the first digit.

printf("The second digit is %d\n", d);

return 0;

}

A similar problem is given at https://brainly.com/question/18340665


Related Questions

Which of these browsers was the first widely adopted?
1. Internet Explorer
2. Chrome
3. Firefox
4. Netscape

Answers

Answer:

netscape

Explanation:

Your network administrator finds a virus in the network software. Fortunately, she was able to eliminate it before it resulted in a denial-of-service attack, which would have prevented legitimate users of the networked database from gaining access to the records needed. It turns out that the network software did not have adequate security protections in place. The fact that this virus was successfully inserted into the network software points to a ______ the network software.

Answers

Answer:

Vulnerability of.

Explanation:

In this scenario, your network administrator finds a virus in the network software. Fortunately, she was able to eliminate it before it resulted in a denial-of-service attack, which would have prevented legitimate users of the networked database from gaining access to the records needed. It turns out that the network software did not have adequate security protections in place. The fact that this virus was successfully inserted into the network software points to a vulnerability of the network software.

In Cybersecurity, vulnerability can be defined as any weakness, flaw or defect found in a software application or network and are exploitable by an attacker or hacker to gain an unauthorized access or privileges to sensitive data in a computer system.

This ultimately implies that, vulnerability in a network avail attackers or any threat agent the opportunity to leverage on the flaws, errors, weaknesses or defects found in order to compromise the security of the network.

Some of the ways to prevent vulnerability in a network are;

1. Ensure you use a very strong password with complexity through the use of alphanumerics.

2. You should use a two-way authentication service.

3. You should use encrypting software applications or services.

What is the name of a shortcut you can click to access other websites? A. A post B. A key C. HTML D. A link

Answers

Answer:

D. A link

Explanation:

I hope this helps.

Answer:

A LINK

Explanation:

I just did the test

What problems might you encounter when using the Web for research?
a. Lack of current news
b. Undocumented sources
c. Lack of search tools
d. Time-consuming searches
e. Unreliable conten

Answers

Answer:

b. d. e.

Explanation:

The web is a vast and endless database of information and has become an invaluable resource for research. That being said it can also bring with it many problems, the main one being unreliable content due to undocumented sources, false testimonies, information with no evidence, etc. The amount of false information on the internet can sometimes make it very time consuming since you have to take the extra step of verifying the information you come across. Despite this, the WEB has information on every topic including current news, and with the wide array of search tools available it is very easy to find what you are looking for.

How to Print output in JavaScript

Answers

If you want to print on a page you can use

document.write();

If you want to write in console then there are multiple options

console.log() - to log information

console.error();- to log errors

console.warn(); - to log warning message

If you want to popup some information the you can use -

alert(message);

there are also various options present in alert.

or

print() essentially just calls up the native print dialog for a given window.

But as you're are thinking, it will work on any window or (i)frame.

thus if you write content to a frame, you can then call this to print it.

window.frameName.print();

note the only drawback (and its a big one), is that this calls up the print dialog... not the print preview window... thus the user doesn't really get a chance to see what they are printing and/or scale it to fit their printer/paper.

I personally wish that all browsers would implement the following to handle the above issue.

window.printPreview();

Hope this will help !!!

Answer:

Just add "document.wright();" to print text.

The binary string 00100100 is a member of which of the following problems? Remember, a "problem" is a language whose strings represent the cases of a problem that have the answer "yes." In this question, you should assume that all languages are sets of binary strings interpreted as base-2 integers. The exception is the problem of finding palindromes, which are strings that are identical when reversed, like 00100100, regardless of their numerical value.

Answers

This question is incomplete, the complete question is;

The binary string 00100100 is a member of which of the following problems? Remember, a "problem" is a language whose strings represent the cases of a problem that have the answer "yes." In this question, you should assume that all languages are sets of binary strings interpreted as base-2 integers. The exception is the problem of finding palindromes, which are strings that are identical when reversed, like 00100100, regardless of their numerical value.

a) Is the given string a palindromes ?

b) Is the given string a perfect cube?

c) Is the given string greater than 50?

d) Is the given string even?

e) is the given string a perfect square?

Answer:

a) the given binary string is a palindromes

b) the given string is NOT a perfect cube

c) the given string is NOT greater than 50?

d) the given string is an even

e) the given string a perfect square

Explanation:

Given that;

binary string : 00100100

a)

Is the given string a palindromes ?

the given binary string = 00100100

now when you reverse the string, its still going to be : 00100100

so the given binary string is a palindromes

b)

Is the given string a perfect cube

the given string : 00100100 = 36

now 2^3 = 8,

3^3 = 27,

4^3 = 64

so 36 is not a perfect cubic

hence the given string is NOT a perfect cube

c)

Is the given string greater than 50?

the given string : 00100100 = 36

and 36 < 50

so the given string is NOT greater than 50?

d)

Is the given string even?

the given string  : 00100100 = 36

and 36 can be divided exactly by 2

so the given string is an even

e)

is the given string a perfect square?

the given string  : 00100100 = 36

now 6^2 = 36  i.e 6 multiply by 6 = 36

therefore the given string a perfect square

what is ovoviviparous? ​

Answers

Answer:

o·vo·vi·vip·a·rous

Explanation:

(of an animal) producing young by means of eggs which are hatched within the body of the parent, as in some snakes.

which check the functioning of all the connected hardwares including primary and secondary storage devices​

Answers

Answer: The computer processor

Explanation:

The computer processor is also called the central processing unit and it's function is to analyzes data and also disperses data. It is the computer's brain as it tells the computer the kind of programs to do at a particular time.

The computer processor checks the functioning of all the connected hardwares including primary and secondary storage devices.

briefly explain the usage of the MS PowerPoint

Answers

Answer:

PowerPoint is a computer program that allows you to create and show slides to support a presentation. You can combine text, graphics and multi-media content to create professional presentations.

Answer:

Making your presentation more interesting through the use of multimedia can help to improve the audience's focus. PowerPoint allows you to use images, audio and video to have a greater visual impact. These visual and audio cues may also help a presenter be more improvisational and interactive with the audience.

Match each task with the features necessary to complete the task

Answers

Is there supposed to be an image?

A network is:
A. A group of people or things that are individually connected to one another.
B. A number of individuals who share the same values and ideas.
C.a means of mass communication in print and other forms.
D. The main idea or information contained in a media piece.

Answers

Explanation:

The answer to this question is A

When computers are connected and operate through one main computer, it is called a _________ network. centralized client server GUI peer-peer

Answers

Answer:

the answer would be a client server

Explanation:

In a situation wherein computers are connected and operate through one main computer, it is called a client server network. Therefore, the option B holds true.

What is the significance of a client server network?

A client-server network can be referred to or considered as a network wherein all the systems that are collectively a part of the computer network are controlled and handled by a single system. This single system of computers is also known as the main computer.

The main computer has access to all the data, as well as information tracking of the activities performed by the main computer. In order to access anything between the different systems, the members systems need to get authorized access through the main computer.

Therefore, the option B holds true and states regarding the significance of a client server network.

Learn more about a client server network here:

https://brainly.com/question/28099574

#SPJ2

Many of the first photographers were actullay scientists and inventors

Answers

Answer:

True, if its a true or false. Otherwise I am of no help.

Explanation:

Answer:

True

Explanation:

what are the earliest invention in human history​

Answers

Answer: Tools, Boats, Hand made bricks.

Explanation: The tools were the first technological advancement, the boats were the next, them hand made bricks for construction.

1605:newspapers
1608:telescope
1620:Compound microscope
1630:Slide rule
1642:mechanical calculator 1643:barometer
1650:vacuum pump
1656:pendulum clock

Hope this is enough

Naseer has inserted an image into his document but needs the image to appear on its own line.

Which option should he choose?

•Top and Bottom
•Tight
•Through
•In front of text

Answers

Answer:

Top and Bottom

Explanation:

took the test

Answer: A

Explanation:

why is makyra a loser??​

Answers

Because she doesn’t have any friends :-(

Answer:

She dumbbbbbbbbbbbbbbbbbbbbbb

Explanation: Her mom watched too much spongebob while pregnant

What are three things to consider in programming design?
the problem being addressed, the goals of the project, and the programming language that will be used
the problem being addressed, the goals of the project, and the age of the end users
the age of the end users, the programming language that will be used, and the programming style of the
programmers working on the project
the age of the end users, the goals of the project, and the programming style of the programmers working on the
project

Answers

The issue being solved, the project's objectives, and the users' ages. The project's programmers' programming styles, the programming language they will use, and the age of the intended customers.

What is programming language?

Programming language is defined as a computer language used to converse with computers by programmers (developers). Orthogonality or simplicity, available control structures, data types, and data structures, syntactic design, support for abstraction, expressiveness, type equivalence, strong versus weak type checking, exception handling, and limited aliasing are among the characteristics of a programming language.

Clarity, simplicity, and unity offer a way to express algorithms as well as a framework for thinking about them. Every possible feature combination has value thanks to orthogonality. Surprisingly, it may frequently be reduced to three basic programming constructs known as loops, selects, and sequences.

Thus, the issue being solved, the project's objectives, and the users' ages. The project's programmers' programming styles, the programming language they will use, and the age of the intended customers.

To learn more about programming language, refer to the link below:

https://brainly.com/question/12696037

#SPJ5

Help me for this question

Answers

Answer:

Answer C

Explanation:

You are welcome

Which of the following is not true about templates?

It incorporates formatting elements.

They slow down the process of creating presentations.

It incoprorates layout options.

It may include content that can be modified.

Answers

The answer is they slow down the creating of presentations.

Write code that determines the number of full days represented by the number of hours stored in the variable hours and stores that value in the variable full_days. For example, the number of full days in 50 hours is 2. Ignore any leftover hours that don't contribute to a full day. Assume the value of hours has already been initialized. Solve It!

Answers

Answer:

hours = 50

full_days = int(hours / 24)

print("The number of full days in " + str(hours) + " hours is " + str(full_days))

Explanation:

Initialize the hours

Since there are 24 hours in a full day, divide the hours by 24. Note that you need to typecast it to the int, because the result is a decimal value by default

Print the values as requested

The person who Oversee the direct work of employees and is responsible for the day-to-day tasks the employees complete is likely

Answers

Answer: Operational Manager

Answer: operational manager

Explanation: APEX

Suppose you have a class Ship, which was written by another programmer who used to work for your employer. Ship is used in several different applications. Ship contains a public method called getBearing() that consults gyroscopes and a compass to determine the direction in which the ship is moving and returns a Location object. You need to refactor the code to use a GPS receiver instead. You should

Answers

Answer:

Research of the GPS features and the modules and packages needed by the programming language to implement and receive data from a GPS tracker.

Explanation:

The Ship class is a blueprint that holds a data structure of a ship's location in coordinates. The location variable can be changed using the getBearing method and an instance of the ship class can be made several times for different ships in the harbor. This class depicts the power of object-oriented programming.

Refactoring is a concept in software engineering where source codes are modified to achieve code efficiency and speed. All programming language source code should be refactored where needed with the right packages or modules.

edhesive 1.7 code practice question 1
Fix the error so that the code works correctly
input (“Enter a number: “)
print (num * 8)
How do I fix the error?

Answers

Answer:

num = int(input("Enter a number: "))

print(num * 8)

Explanation:

I highlighted the parts that are added

Since you are getting an input from the user, you need to set the result to a variable. In this case, it is num.

Since it is a number, you need to specify the its type. In this case, it may be int.

Also, the quotation marks must be written as seen.

The corrected program which ensures that the program runs correctly is written thus :

num = int(input("Enter a number: ")

#user supplied input should be assigned to the varibale num

print(num * 8)

#multiplies num by 8 and displays the output.

The num variable in the second line isn't attached to any value, therefore, it will throw an error.

The user input value should be attached to the variable, 'num'

The second line of code multiplies num by 8 and displays the product.

Therefore, if the the user input is 3 ; the final result displayed will be : (3 × 8) = 24.

Learn more :https://brainly.com/question/15566254

Explain demand paging with a proper example

Answers

Demand paging :

In computer operating systems, demand paging (as opposed to anticipatory paging) is a method of virtual memory management. In a system that uses demand paging, the operating system copies a disk page into physical memory only if an attempt is made to access it and that page is not already in memory (i.e., if a page fault occurs). It follows that a process begins execution with none of its pages in physical memory, and many page faults will occur until most of a process's working set of pages are located in physical memory. This is an example of a lazy loading technique.

The question is in the picture

Answers

Answer:

nordthaf

Explanation:

nofth

What is true about connectionless packet switched networks? a. each datagram must contain both source and destination addresses b. without a connection, datagrams may not arrive in sequential order at the destination c. establishment of a connection between communicating points is not required prior to exchanging datagrams, thus reducing overhead communications d. all of the above are true

Answers

Answer:

d. all of the above are true

Explanation:

Connectionless Packet Switching is a term that is used in computer networking operations to describe the breaking of information exchange path into a various packet of small sizes acquired and refined over network switches and routers, which is then transferred from one subsequent node to the other. It is sometimes referred to as Datagram Networks

However, during this operation, Connectionless Packet Switching must satisfy the following amongst others:

1.  each datagram must comprise both source and destination addresses

2.   without a connection, datagrams may not come in sequential order at the destination

3.  establishment of a connection between communicating points is not needed prior to exchanging datagrams, thus reducing overhead communications

Therefore, considering the available options, the correct answer is option D

Where is the video card located in a computer?

Answers

Video card??????????
pretty sure it’s in the motherboard?

For what purpose are high-level programming languages used for

1. Give control over the hardware to execute tasks quickly

2. Provide code that controls the computers hardware

3. Translate low-level programming languages into machine code

4. Write programs for general applications

Answers

Answer:

To speed up the compiler during run time

Explanation:

true false) keybord has two shift keys.​

Answers

Answer:

True, looking at 'em right now!

Explanation:

Write a Java program that prompts the user for an int n. You can assume that 1 ≤ n ≤ 9. Your program should use embedded for loops that produce the following output: 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1 . . . n . . . 5 4 3 2 1 Your prompt to the user should be: Please enter a number 1...9 : Please note that your class should be named PatternTwo.

Answers

Answer:

Here is the JAVA program:

import java.util.Scanner;  // to take input from user

public class PatternTwo{   //class name

public static void main(String args[]){  //start of main function

Scanner scan = new Scanner(System.in);   // creates Scanner class object

System.out.print("Please enter a number: ");  //prompts user to enter an int n for the number of rows

int n = scan.nextInt();   //reads and scans the value of n from user

int i, j;   //declares two variables to iterate through i  rows and j columns

for (i=1; i<=n; i++){    //outer loop for rows  

for (j=2*(n-i); j>=1; j--){   //inner loop for space between numbers in pattern  

System.out.print(" ");  }   //displays an empty space in the pattern

for (j = i; j >= 1; j--)  { //inner loop for columns  

System.out.print(j+" "); }   //prints the value of j (prints numbers in reverse)

System.out.println();   }   }   }  //prints a new line after printing each row

Explanation:

The program is explained with an example in the attached document.

Other Questions
Plz help its due in 20 minutes Which Olmec center traded rubber, cacao, and salt?A) San LorenzoB) Laguna de los CerrosC) GrijalvaD) La Venta 1. Our group is planning a trip to New York Exercise 1 Write S above each singular noun and pl. above pl. The staff voted to rearrange their schedules. pl (HIGH POINTS) PLEASE HELP URGENTLY!!! What are the coordinates of the vertices of AA'B'C' after each movement? Calculate the average speed between 160 s to 200 s What did the colony of Rhode Island start out as? Can someone help me out!!!!!!!!!!!! Please!!!!!! Please!!!!!!!!!! I really need help!!!!!! 8. The students were looking at their debts, Holmes is in $90,00 of debt.Reyes has $67.00 of debt. Dixon has $79.00 of debt. Hunter has a positivebank balance of $100.00. Who owes the most money?Please help me Factor x3 7x2 5x + 35 by grouping. What is the resulting expression? o (x2 7)(x - 5) (x2 7)(x + 5) (x2 5)(x 7) (x2 + 5)(x 7) write a mathematical proof to show that 2( x+3) +4(5+x) is equivalent to 6x+26 What is the answer this probelm Realiza el anlisis sintctico de los ejemplos propuestos (sujeto Verbo Complementos) - All est la casa del to Lucas. - Este camino termina aqu. - Ese hombre dijo: este es mi reloj. - Marta busc por todas partes a su madre y cuando la encontr dijo: Esa es mi madre. - Los hombres la miraban pero nadie la ayudaba. - Alguien pregunt por m? - De tus labios brotaban aquellas extraas palabras. Choose the midpoint of the line segment with endpoints at (5, 9) and (11, 15).A) (16,24)B) (6,6)C) (8,12)D) (-6,-6) Michael and Ming-Wei are selling fruit for a school fundraiser. Customers can buy small boxes oforanges and large boxes of oranges. Michael sold 3 small boxes and 14 large boxes for a total of $203.Ming-Wei sold 11 small boxes and 11 large boxes for a total of $220. Find the cost of each size box. Adrian is a patient at a hospital. He is prone to emotional outbursts during group lunches. In addition, he often yells athimself when there is quiet time. Which best describes how the nursing assistants should respond to Adrian?The nursing assistants should try to decrease Adrian's feelings of anxiety by calming him down.The nursing assistants should identify Adrian's withdrawal and related irritability and insomnia.The nursing assistants should try to dismiss Adrian's emotions and ignore his behavior.The nursing assistants should listen to Adrian and avoid any conversations that could make him more disruptive. cuales son las semejanzas de lenguaje culto y lenguaje coloquial The following question has two parts. First, answer part A. Then, answer part B.Part AWhich statement BEST summarizes the central idea of the text?ADr. Mortimer has no idea what happened to his friend, Sir Baskerville, but isbeing nosy and trying to get true information from Sherlock Holmes byfeeding Holmes a few facts.00Dr. Mortimer is suspicious that something ghostly or superstitious had ahand in the death of his friend. Sir Baskerville.0Dr. Mortimer does not want Sherlock Holmes to continue his investigation,so he is giving Sherlock Holmes false information without Holmes realizingitDDr Mortimer is attempting to convince Sherlock Holmes that Sir Baskerville'sbutler, Barrymore, lied to the police because he had a hand in the death ofSir Baskerville how does air pollution affect people in China? Today only, a table is being sold at a 26% discount. The sale price is $481.What was the price yesterday?