Computer Science
Distinguish between:
Finite loop and Infinite loop
Java Iterative Stmts
21 Likes
Answer
Finite loop | Infinite loop |
---|---|
It iterates for a finite number of iterations. | It continues iterating indefinitely. |
Example: int i = 1; while(i <= 10) { System.out.println(i); i++; } | Example: int i = 0; while(i <= 10) { System.out.println(i); } |
Answered By
10 Likes
Related Questions
What is a token? Explain these methods while reading token from Scanner object.
(a) nextlnt( ) (b) nextDouble( )
(c) next( ) (d) nextLine( )With reference to switch case, explain the following:
(a) Default case
(b) Fall through
Distinguish between:
Exit controlled loop and Entry controlled 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.