Sale!

# HomeWork-1 Digits in Order, Integer

\$30.00

Category:
Rate this product

HomeWork-1
You must write name header on the top of every
homework assignment. (It will include your name, id,
Assignment number).
Exercise A (Digits in Order, Integer)
Write a program that reads a four-digit integer from the user, and then displays it one digit per
line.
For example, assume the user enters 1234 (one
thousand two hundred and thirty four), then your
program will display:
1
2
3
4
Your prompt should tell the user to enter a four-digit integer. We are not dealing with string here.
(Hint: Use division and mod operator). It should work for any 4 digits integer.
Exercise B (Digits String)
Write a program that reads the four digit integer as
a STRING such as 2018, and then displays it, one
digit per line. After printing the string digits in order,
print them in reverse order
Note: Here we are using string function.
You must use negative index number to print the
digits in reverse order.
Exercise C (Fahrenheit-Celsius Converter)
Write a program that converts Celsius temperature to Fahrenheit temperatures. The formula is as
follows: The program should ask the user to enter a temperature in Celsius, then display the
temperature converted to Fahrenheit. (Design your own output)
𝐹 =
9
5
C + 32

Exercise D (Joining Names)
Write a program that read 3 strings from the
user: their first name, middle initial (keep in mind,
user can enter his full middle name but as a
programmer we are dealing with only initials) and
last name. Display each string, along with its length
on separate lines.
Then join (concatenate) the three strings into one,
with commas in-between.
Exercise E (Distance Traveled)
Assuming there are no accidents or delays, the distance that a car travels down the interstate can
be calculated with the following formula:
Distance = Speed * Time
A car is travelling 70 miles per hour. Write a program that displays the following:
 The distance the car will travel in 6 hours.
 The distance the car will travel in 10 hours.
 The distance the car will travel in 15 hours.
You must use tab for this output and quote “70 miles per hour”
Note: In all the exercises, your output must match with my output (if given). I want to see the
understanding of few concept that is important. 10 and 10.0 is different in programming.

Hello