Problem: 1 do-while, switch case
Write software that offers the person the opportunity of 5 preferred beverages (Coke, Fanta, Sprite,
Pepsi, mineral water) then allow the person to determine a nutrient via way of means of entering into range 1-5.
The output that nutrient they chose. User will offer choices until he/she has coins in his/her
account and display message “out of money” with ultimate stability as soon as a person has not
sufficient coins to buy a minimal price drink (You have to use a transfer statement).
Note:
1. price of each drink is completely unique and larger than zero (You will initialize prices).
2. Input Balance from a person.
3. Input stability has to be larger than a minimal price drink.
4. whilst a person enters his/her opportunity both he/she desire to buy a drink or not (use bool
statistics type).
5. display a variety of beverages with ultimate stability if the person didn't desire to buy a drink or
out of stability.
Problem: 3 do-while
White an application that discovers the Lest Common Multiple to get enters the last two digits of your Roll numbers from the user.
Hint: LCM of integers a and b is the smallest superb integer this is divisible with the aid of using
each a and b.
Problem: 4 do-while
White a software that discovers the Highest Common Factor through getting enter of the last two digits of your Roll number from the user.
For Example
Hint: The biggest integer that can flawlessly divide integers is referred to as HCF of these
numbers.
Problem: 4
A university has 2000 college students and 2000 lockers, one locker for every scholar. The major perform the recreation:
he asks the primary scholar to head and open all of the lockers. he then asks the second scholar to head and near all of the even-numbered lockers. The 1/3 scholar is requested to test each 1/3 locker.
If it's far open, the scholar closes it; if it's far closed, the scholar opens it. The fourth scholar is requested to test each fourth locker. If it's far open, the scholar closes it; if it's far closed, the scholar opens
it. The last college students retain this recreation. In general, the nth scholar tests each nth
locker. If the locker is open, the scholar closes it, if it's far closed, the scholar opens it. After all of the college students have taken their turn, a number of the lockers are open and a few are closed.
Write an application that activates the consumer to go into the variety of lockers in a university. After the
recreation is over, this system outputs the variety of lockers that can be opened. Test run your application for the subsequent inputs: 2000, 5000, 10000. Do you notice any sample developing?
Hint: Consider locker variety 100. This locker is visited with the aid of using scholar numbers 1, 2, 4, 5, 10, 20,
25, 50, and 100. These are the effective divisors of 100. Similarly, locker variety 30 is visited with the aid of using scholar numbers 1, 2, 3, 5, 6, 10, 15, and 30. Notice that if the variety of effective divisors of a
locker variety is odd, then on the cease of the recreation, the locker is opened. If the
variety of effective divisors of a locker variety is even, then on the cease of the recreation, the locker
is closed.