 # 1. An old Arabian legend has it that a fabulously wealthy but unthi...

## Question

1. An old Arabian legend has it that a fabulously wealthy but unthinking king agreed to give a beggar one cent and double the amount for 64 days. Then determine on which day the king will have paid the beggar a total of one million dollars. Using this information, write at C# program that displays how much the king must pay the beggar on each day. Output should be displayed in dollars with two decimal places, not pennies. Do not hardcode the values. Output should look similar to below.

Sample Run:
Day      Amount Owed
---      -----------

1 0.01
2 0.02 3       0.04 ...

64       92233720368547760.00

On day 27 the king paid a total of one million dollars

2. Carbon-14 dating is a common technique for measuring the approximate age of matter that was once living. The formula for measuring time base on Carbon-14 decay is t = (T / ln(2) * ln(1 + D / P)) where T is the half-life of Carbon-14 (5730 years), ln(2) is natural logarithm of 2, D is the amount of carbon-14 fund in a given dead sample, and P is the amount of Carbon-14 in a living specimen today. Write a C# program that asks the user input the value of D/P (such as 0.5) for a given sample and outputs the approximate age of the sample in years. Use a named constant and a method in the problem. Output the result to two decimal places.

Sample Run:
This program calculates the age of a dead sample based on the ratio of Carbon 14 in a dead sample.

Enter the ratio D/P: .05

Given a D/P ratio of 0.05 for C14, the age of the sample is 403.33 years.

3. If a number is the only number between a prime number and a square number it is beprisque. Write a C# program that that asks to the user to check to see if the number entered is beprisque or not. Check for numbers between 1 and 10000 only. The first 10 beprisque numbers are: 1, 2, 3, 8, 10, 24, 48, 80, 82, 168. The values must not be hardcoded. Output should look similar to below.

Sample Runs:

Enter a number: 24
24 is a beprisque number.

Enter a number: 300
300 is not a beprisque number.

## Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

class Beprisque
{
static void Main(string[] args)
{
Console.Write("Enter a number: ");
int number;
if (int.TryParse(line, out number)) // Try to parse the string as an integer
{
int left = number - 1;
int right = number + 1;
if (isPrime(left) && isSquare(right) ||
isPrime(right) && isSquare(left))
{
Console.WriteLine("{0} is a beprisque number.", number);
}
else
{
Console.WriteLine("{0} is not a beprisque number.", number);
}
}
else
{
Console.WriteLine("Invalid number");
}
}...
\$38.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.