Here you go. The program will count entered zeros. Null is not happening here...
int main()
{
int NNeg = 0;
int NPos = 0;
int NZero = 0;
std::cout << "Enter 6 numbers:\n";
for (int i = 0; i < 6; i++) {
double number;
std::cin >> number;
if (number < 0.0) NNeg++;
else if (number > 0.0) NPos++;
else NZero++;
}
std::cout << "You entered:\n";
std::cout << NNeg << " negative numbers\n";
std::cout << NZero << " times zero\n";
std::cout << NPos << " positive numbers\n";
}
Answer: a)
(b)
(c)
(d)
Explanation:
The formal description of the given sets are as follows :-
a) The set containing the numbers 5, 9, and 27.
(b) The set that contains all the natural numbers less than 2.
(c) The set containing the empty string.
We know that in formal description, the empty string is denoted with .
Thus, the required set :
(d) The set containing nothing at all.
Answer:
Desired MATLAB code is explained below
Explanation:
function savingsBalance = CalculateBalance(numberYears, savingsBalance)
% numberYears: Number of years that interest is applied to savings
% savingsBalance: Initial savings in dollars
interestRate = 0.025; % 2.5 percent annual interest rate
% Complete the for loop to iterate from 1 to numberYears (inclusive)
for (i = 1 : numberYears)
savingsBalance = savingsBalance + (savingsBalance * interestRate);
end
end