Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Variables - Quiz #1 Kilobytes in Bytes One Kilobyte is 1024 bytes, Write a program that prompts the user to enter the number of

image text in transcribed

image text in transcribed

c++

Variables - Quiz #1 Kilobytes in Bytes One Kilobyte is 1024 bytes, Write a program that prompts the user to enter the number of bytes, then calculates and prints the number of equivalent kilobytes and the number of bytes. For example, if the number of bytes is 7835 then there are 7835 / 1024 = 7 kilobytes and 7835 % 1024 667 bytes. See sample input/output below: Sample input/output: Enter the number of bytes: 7835 There are 7 kilobytes and 667 bytes in 7835 bytes PIN Number Write a program that reads a three digit-integer and adds to it a fourth digit in the ten position to produce a valid bank PIN number. A valid bank PIN number is a four digit-integer has the property that the sum of its four digits is a multiple of 10. For example, if the number read is 725 then if we add to it in the ten position the digit 6 then we will have the new number 7265 with the property that 7+2+6+5 = 20 which is a multiple of 10. Sample inputs / outputs: Enter a 3-digit integer: 725 Enter a 3-digit integer: 721 The PIN number is 7265 The PIN number is 7201 Round a Decimal Number Write a program that prompts the user to enter a decimal number, rounds the number to two decimal digits, and prints the rounded number. Sample inputs / outputs: Enter a decimal number: 34.78306 Enter a decimal number: 572.83614 The new number is 34.78 The new number is 572.84 Money Money Money: Write a program that prompts the user to enter the money he/she has in pennies, nickels, dimes, and quarters, then the program calculates the total money in pennies. For example if the user has 17 pennies, 29 nickels, 23 dimes, and 7 quarters, then the final answer is 17+5* 29+10* 23+25* 7 = 567. Assume the following: 1 nickel is 5 pennies, 1 dime is 10 pennies, 1 quarter is 25 pennies. Sample input/output: Enter the pennies, nickels, dimes, and quarters: 17 29 23 7 The total money is: 567 Sum the Odd and Even Numbers Write a program that reads 5 positive integers, sums, and prints the odd and even integers. Sample input/output: Enter 5 positive integers: 27 8 56 12 99 The sum of odd integers is: 126 The sum of even integers is: 76 Carpet Price: The price of a carpet is 33 dirham per square foot. Write a program that prompts the user to enter the length and width of a carpet each in feet and inches. The program calculates and prints the area in square foot and the price of the carpet. Sample input/output: Enter the length in feet and inches: 5 3 Enter the width in feet and inches: 48 The price of 24.5 square foot is: 808.5 dirham

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions