77.8k views
20 votes
Java

Problem 2-4 Pennies Problem

Problem 2-4. Pennies Problem. Here’s an old problem. Today, I’ll give you a penny. Tomorrow, I’ll give you two pennies. I’ll keep doubling the amount I’ll give you for 30 days. How much will you have at the end of the month (better use a long integer type to keep track)?

1 Answer

3 votes

it is easy to type this in Java

Step-by-step explanation:

class pennies 1

{

public static void main ()

{

System.Out.println("Here’s an old problem. Today, I’ll give you a penny. Tomorrow, I’ll give you two pennies. I’ll keep doubling the amount I’ll give you for 30 days. How much will you have at the end of the month (better use a long integer type to keep track)?")

}

}

User Koalabruder
by
3.2k points