Computer Science
Distinguish between:
Exit controlled loop and Entry controlled loop
Java Iterative Stmts
21 Likes
Answer
Exit controlled loop | Entry controlled loop |
---|---|
It checks the condition after executing its body. If the condition is true, loop will perform the next iteration otherwise program control will move out of the loop. | It checks the condition at the time of entry. Only if the condition is true, the program control enters the body of the loop. |
The loop executes at least once even if the condition is false. | Loop does not execute at all if the condition is false. |
Example: do-while loop | Example: for and while loops |
Answered By
11 Likes
Related Questions
With reference to switch case, explain the following:
(a) Default case
(b) Fall through
Distinguish between:
Finite loop and Infinite loop
A company deals with two types of customers (i.e. dealer and retailer) for selling its goods. The company also offers discount to the dealer and retailer at the time of purchasing goods for paying the bill, as per the tariff given below:
Days of payment Discount for Dealer Discount for Retailer Within 30 days 15% 10% 31 to 45 days 12% 8% 46 to 60 days 10% 5% More than 60 days No discount No discount Write a program in Java to accept:
(a) The number of days within which the bill is to be paid.
(b) The type of customer 'D' for dealer and 'R' for retailer.
(c) The amount of purchase.The program displays the details to the customer at the time of paying the bill.
Write a menu driven program using switch case statement to find the Arithmetic mean, Geometric mean and Harmonic mean which are calculated as:
(a) Arithmetic mean = (a + b) / 2
(b) Geometric mean = √ab
(c) Harmonic mean = 2ab / (a + b)