Write a program that declares and initializes a variable representing the weight in milligrams from the keyboard. The program displays the equivalent weight in kilograms, grams, and milligrams. For example, 1050042 milligrams are equivalent to 1 kilogram, 50 grams, and 42 milligrams.

Answers

Answer 1

Answer:

weight = int(input("Enter weight in milligrams: "))

kilograms = int(weight / 1000000)

grams = int((weight - (kilograms * 1000000)) / 1000)

milligrams = weight - ((kilograms * 1000000) + (grams * 1000))

print("{} milligrams are equivalent to {} kilogram(s), {} gram(s), and {} milligram(s)".format(weight, kilograms, grams, milligrams))

Explanation:

*The code is in Python.

Ask the user to enter the weight and set it to the variable weight

Calculate the kilograms, divide the weight by 1000000 and cast the result to the int (If the weight is 1050042, kilograms would be 1050042/1000000 = 1)

Calculate the grams, subtract the kilograms from the weight, divide it by 1000 and cast the result to the int (If the weight is 1050042, grams would be int((1050042 - (1 * 1000000)) / 1000) = 50)

Calculate the milligrams, subtract the kilograms and grams from the weight (If the weight is 1050042, milligrams would be 1050042 - ((1 * 1000000) + (50 * 1000)) = 42)

Print the weight, kilograms, grams, and milligrams in the required format

Answer 2

In this exercise we have to use the knowledge of the python language to write the code, so we have to:

The code is in the attached photo.

Some important information informed in the statement that we have to use in the code is:

Calculate the kilograms, divide the weight by 1000000 and cast the result.Calculate the grams, subtract the kilograms from the weight, divide it by 1000 and cast the result.Calculate the milligrams, subtract the kilograms and grams from the weight.

So to make it easier the code can be found at:

weight = int(input("Enter weight in milligrams: "))

kilograms = int(weight / 1000000)

grams = int((weight - (kilograms * 1000000)) / 1000)

milligrams = weight - ((kilograms * 1000000) + (grams * 1000))

print("{} milligrams are equivalent to {} kilogram(s), {} gram(s), and {} milligram(s)".format(weight, kilograms, grams, milligrams))

See more about python at brainly.com/question/26104476

Write A Program That Declares And Initializes A Variable Representing The Weight In Milligrams From The

Related Questions

#include
main()
{
int i, n=10, rem, inc=0;
scanf("%d",&n);
for(i=1; i =3)
inc++;
else;
inc--;
}
printf("Final Value=\n",inc);
}
SOLVE THIS PROGRAM...

Answers

Answer:inpossible !889

Explanation: I npossible !889

The intelligence displayed by humans and other animals is termed?

Answers

Answer:

ᗅгᝨเŦเςเᗅl เภᝨєllเﻮєภςє, Տ⌾๓єᝨเ๓єՏ ςᗅllє๔ ๓ᗅςђเภє เภᝨєllเﻮєภςє ⌾г ๓ᗅςђเภє lєᗅгภเภﻮ, เՏ เภᝨєllเﻮєภςє ๔є๓⌾ภՏᝨгᗅᝨє๔ ๒γ ๓ᗅςђเภєՏ, เภ ς⌾ภᝨгᗅՏᝨ ᝨ⌾ ᝨђє ภᗅᝨႮгᗅl เภᝨєllเﻮєภςє ๔เՏקlᗅγє๔ ๒γ ђႮ๓ᗅภՏ ᗅภ๔ ⌾ᝨђєг ᗅภเ๓ᗅlՏ. ... Տ⌾๓єᝨђเภﻮ ᝨђᗅᝨ'Տ ђєlקเภﻮ ᝨђเՏ ςђᗅภﻮє เՏ ᗅгᝨเŦเςเᗅl เภᝨєllเﻮєภςє.

հօթҽ íԵ հҽlթs

Natural intelligence relates to life concepts and life choices which adhere to the natural constraints or boundaries of the world's resources and the further discussion can be defined as follows:

It is defined as an emotional impulse ingrained into the common myth that drives us to value & defend the integrity of any living creatures.It is the polar opposite of artificial intelligence, which is all of the control mechanisms found in life. Nature also displays non-neural control in plants and protozoa, as well as dispersed intellect in colonies species including such ants, jackals, and people.

Therefore, the final answer is "Natural intelligence".

Learn more:

brainly.com/question/16456970

Where or what website can I download anime's? For free ​

Answers

https://todo-anime.com/

4. What are the traits of a good follower?​

Answers

Answer:

Judgment. Followers must take direction, but not blindly. Work ethic. Good followers are good workers. Competence. In order to follow, followers must be competent. Honesty. Followers have a responsibility to be honest. Courage. Discretion. Loyalty. Ego management.


What is the total March Expenditure now? (cell Q2)

Answers

I did a lot to do it lol was
Other Questions
The distance from the ground to where the ladder is touching the wall is 7feet. The distance from the wall to the base of the ladder is 4 feet. What isthe length of the ladder?wallladder 50 points will mark brainliest An international company has 23,200 employees in one country. If this represents 26.7% of the company's employees, how many employees does it have in total?Round your answer to the nearest whole number. This probability distribution shows the typical grade distribution for a Geometry course with 35 students. HELLLPPP PLSSS (The Perfect Storm) Whom did the Coast Guard first attempt to rescue? Can someone help me with this ? I need help with Seek justice My Life blueprint Template. what eventually happend to balboa Good authors choose their words very carefully. Take a few minutes to write a short paragraph describing an experience you have recently had. Pick a location you went to or an event you attended. Once you have finished, read over what you have written. Now, write a second paragraph. In it, you will repeat the information from the first paragraph, but you will choose your words more carefully. Ask yourself questions like: What words capture this image exactly? What is the best word to convey how something looked, or how I felt? Take more time with the second paragraph. Your response should be at least 150 words in total When the Australian wildfires occurred, what short-term effect did theecosystem experience?A. Plants and/or animals relocated or died.B. All of the plants died but the animal population increased.C. There was no effect on the ecosystem.D. The trees grew back quick and the animals were not affected How are these three numbers related. 50 1/2, 1/4, 202 In which country did President George H. W. Bush have to practically disregard his humanitarian goals to achieve what he believed was in thebest interest of the United States? Classify the polynomial according to its degree and number of terms.9 constant monomial sixth-degree monomial linear binomial sixth-degree binomial PLEASE HELP!!!! Choose the word for "where someone lives" that has the most positive connotation.A.) residenceB.) homeC.) houseD.) address Diamond measured the base of a soda can and the diameter was 4 inches. What is the circumference of the bottom of the can? a.9 inches b25.1 inches c12.6 inches d50.2 inches Consider an experimental setup with two compartments separated by a phospholipid bilayer membrane containing ion channels selectively permeable only to chloride ions. The left compartment (also called inside) contains 1 mM Cl- and the right compartment (also called outside) contains 100 mM Cl-. What will the electrical potential be when the system attains equilibrium Which is the following farms famous for growing of grapes?A. Ketchs' FarmB. Gapuz Grapes FarmC. Melona Farm D. Lapuz Grapes Farm"HELP ME GUYS PLSSS" In the ocean, there are small fish that live in and around the mouths of large sharks. The shark does not harm the fish because the fish pick food from between the shark's teeth. In return the small fishsymbiosis exists between the sharks and the small fish?o commensalismmutualismparasitismpredation Which best defines a topic and position in an argumentative essay about household chores? I dont like doing chores, but my parents insist that I clean my room, pick up the trash, and feed our cats. They say it is good for me. Some chores are boring, like sweeping the floor and cleaning bathrooms. Some chores are more exciting, like washing the car and digging in the garden. Some people think making dessert is a fun chore. Listening to music and sharing a job with a friend are both ways to complete work faster. Time flies when youre having fun. I think children should be expected to help more at home. Doctors and teachers agree that children who learn to complete chores are healthier and better students than children who do not. ____________ are calibrated to deliver one fixed volume and are ____________ than ______________. Select one: a. Transfer pipets; less accurate; measuring pipets b. Transfer pipets; more accurate; measuring pipets c. Measuring pipets; more accurate; transfer pipets d. None of these answers is correct. e. Measuring pipets; more precise; transfer pipets