The code below is used to determine a recursive, bool-valued function, isPalindrome, that accepts an integer-valued array, and the number of elements and returns whether the array is a palindrome.
Explanation:
- The code shows 'array palindrome' is an array which, when its elements are reversed, remains the same.
bool isPalindrome(arr[((n-1) - n) +1], n)
{
if (n == 0 || n == 1)
{
return true;
}
else if (arr[n-1] == isPalindrome(arr[], n-1)
{
return true;
}
else {
return false;
}
}
Answer:
=IF( B7 = 12, ( IF( B10 = 10,"YES", "")), 7) and PRESS ENTER
Explanation:
the above logical if function checks the following
-IF cell B7 is 12, if true, check the value of cell B10, IF cell B10 contains 10 the function should produce YES as output to whatever cell selected, IF B10 is not 10 output of the function should be an empty string, IF B7 is not equal to 12 the the output of the function should be 7.
Answer:
- If a group of 9 kids have won a total of 100 trophies, then at least one of the 9 kids has won at least 12 trophies.
- If a person buys at least 400 cups of coffee in a year, then there is at least one day in which the person has bought at least two cups of coffee.
- The average of three real numbers is greater than or equal to at least one of the numbers.
Explanation:
1)
Suppose that each kid has less than 12 trophies
Total trophies = 100
Maximum trophies won by one kid = 11
total kids = 9
total number of trophies = 9 * 11 = 99 which contradicts the fact the total number of trophies are 100
2)
Suppose that person has less than 2 cups of coffee a day
Total cups of coffee = 400
he has bought at least one cup of coffee each day
which means
total number of cups of coffee = 1* 366 = 366 which contradicts the fact the person buys at least 400 cups of coffee in a year
3)
Average of three number = (a+ b+ c)/3
suppose that there are real numbers a, b, and c such that all three numbers are less than the average of the three numbers.
Let m be the average (a+b+c
)/3 = m. Then our assumption states that (a < m) and (b < m) and (c < m). By adding all the inequalities we get a + b + c < 3m. But m is defined to be (a+b+c)
/3 , so a + b + c = 3m. But now we have that 3m = a + b + c < 3m. So 3m < 3m which is an obvious contradiction. Thus our claim is true
Answer:
Se explaination
Explanation:
/Declaring variables
integer currentPrice
integer lastMonthPrice
integer changeLastMonth
float mortagage
//Reading input
currentPrice = Get next input
lastMonthPrice = Get next input
//Calculating price change
changeLastMonth = currentPrice - lastMonthPrice
//Calculating mortagage
mortagage = (currentPrice * 0.051) / 12
//Printing output
Put "This house is $" to output
Put currentPrice to output
Put "\nThe change is $" to output
Put changeLastMonth to output
Put " since last month." to output
Put "\nThe estimated monthly mortgage is $" to output
Put mortagage to output