The rule of 72 is use to make a quick estiment of the time required for prices to double due to inflation. If the inflation rate is (r)percent, then the rule of 72 estimates that prices will double in 72/r years. For instance, at an inflation rate of 6 percent, prices double in about 72/6 or 12 years. Write a program to test the accuracy of this rule. The program should display a table showing, for each value of (r) from 1 to 20, the rounded value of 72/r and the actual amount number of years required at the end of each year).

To write a program that tests the accuracy of the rule of 72, you can use a loop to iterate through each value of r from 1 to 20. Within the loop, you can calculate the rounded value of 72/r and compare it to the actual number of years required for prices to double.

Here's an example program in Python that accomplishes this:

```python
# Loop through each value of r from 1 to 20
for r in range(1, 21):
# Calculate the rounded value of 72/r
rounded_years = round(72 / r)

# Calculate the actual number of years required for prices to double
actual_years = 72 / (100 / r)

# Display the results in a table
print(f"Inflation rate: {r}%")
print(f"Rounded value of 72/r: {rounded_years} years")
print(f"Actual number of years required: {actual_years} years")
print("-------------------")
```

When you run this program, it will display a table showing the rounded value of 72/r and the actual number of years required for each value of r from 1 to 20. This will allow you to compare the two and see how accurate the rule of 72 is for estimating the time required for prices to double due to inflation.