Write a program that will ask user to enter a digit character (i.e. ‘0’ or ‘1’ .... or ‘9’). If user
enters a non-digit character then the program should display message to re-enter correct input. If user
enters a correct character (i.e. a digit character) then your program should convert that character to
a same digit but in integer type. Do this for five inputs. Finally, add all digits and display their sum. Do
not use any library function or loops.
A New Telephone Company has the following rate structure for long distance calls:
● The regular rate for a call is $0.10 per minute. (10 marks)
● Any call started at or after 6:00P.M. (1800 hours) but before 8:00A.M. (0800 hours) is
discounted 50 percent.
● Any call longer than 60 minutes receives a 15 percent discount on its cost (after any other
discount is subtracted).
● All calls are subject to a 4 percent federal tax on their final cost.
Programming Fundamentals – Assignment 1 (Spring 2022)
Write a program that reads the start time for a call based on a 24-hour clock and the length of the call.
The gross cost (before any discounts or tax) should be printed, followed by the net cost (after discounts
are deducted and tax is added). Print instructions to the user and compute the net cost. without using loops, functions
A New Telephone Company has the following rate structure for long distance calls:
● The regular rate for a call is $0.10 per minute. (10 marks)
● Any call started at or after 6:00P.M. (1800 hours) but before 8:00A.M. (0800 hours) is
discounted 50 percent.
● Any call longer than 60 minutes receives a 15 percent discount on its cost (after any other
discount is subtracted).
● All calls are subject to a 4 percent federal tax on their final cost.
without using loops or functions
The following algorithm is designed to print the beginning of what is known as the
Fibonacci sequence. Identify the body of the loop. Where is the initialization step for the
loop control? The modification step? The test step? What list of numbers is produced?
Last ← 0;
Current ← 1;
while (Current < 100) do
(print the value assigned to Current;
Temp ← Last;
Last ← Current; and
Current ← Last + Temp)
Describe a tree structure that can be used to store the genealogical history of a family. What operations are performed on the tree? If the tree is implemented as a linked structure, what pointers should be associated with each node? Design procedures to perform the operations you identified above, assuming that the tree is implemented as a linked structure with the pointers you just described. Using your storage system, explain how one could find all the siblings of a person.
The following program segment is an attempt to compute the quotient (forgetting any remainder) of two positive integers (a dividend and a divisor) by counting the number of times the divisor can be subtracted from the dividend before what is left becomes less than the divisor. For instance, 7⁄3 should produce 2 because 3 can be subtracted from 7 twice. Is the program correct? Justify your answer.
Count ← 0;
Remainder ← Dividend;
repeat (Remainder ← Remainder – Divisor;
Count ← Count + 1)
until (Remainder < Divisor)
Quotient ← Count.
Write a program which takes a 9-digit number input from user, converts it into its reverse
No loops you can use only conditional structures.
Write a program which takes a number n as input and prints YAYY if the sum of all digits except the rightmost digit is equal to the rightmost digit., otherwise print OOPS. For example: If user enters 2237, it will print YAYY because 2+2+3 is equal to 7. Whereas, if user enters 3425, it will print OOPS because 3+4+2 is not equal to 5.
you can only use conditional structures . NO loops.
Paula and Danny want to plant evergreen trees along the back side of their yard. They do not want to have an excessive number of trees.
Write a program that prompts the user to input the following:
The program outputs:
Format your output with setprecision(2) to ensure the proper number of decimals for testing!
An egg distribution company uses different sizes of packings for eggs, that is, 30 eggs packing, 24 eggs packing, 18 eggs packing, 12 eggs packing and 6 eggs packing. Write a program which prompts user to enter total number of eggs (input validation is always must) to be packed and then calculate how many packings of each size will be possible. Also tell if there will be any eggs left to be packed.
Not to use Loops , functions,arrays and pointers.