Answer:
#include <iostream>
using namespace std;
int main()
{
int rows, width, height, spaces, stars; // declare values
cout << "enter width" << endl;
cin >> width;
cout << "enter height" << endl;
cin >> height;
for (int row = 0; row < height; ++row) {
for (int col = height + row; col > 0; --col) {
if (height % 6 == 1) {
cout << "Impossible shape!" << endl;
return 0;
}
cout << " ";
}
for (int col = 0; col < (width - 2 * row); ++col) {
cout << "*";
spaces += 1;
stars -= 2;
}
cout << endl;
Answer:
A Program was written to carry out some set activities. below is the code program in C++ in the explanation section
Explanation:
Solution
CODE
#include <iostream>
using namespace std;
int main() {
string name; // variables
int number;
cin >> name >> number; // taking user input
while(number != 0)
{
// printing output
cout << "Eating " << number << " " << name << " a day keeps the doctor away." << endl;
// taking user input again
cin >> name >> number;
}
}
Note: Kindly find an attached copy of the compiled program output to this question.
Answer:
Explanation:
We can use for-loop in python to calculate the tuition amount in the next 5 years. If the tuition is increasing 3% each year, in each loop we can multiply the amount by 1.03
tuition = 8000
for year in range(1,6):
tuition *= 1.03
print("The tuition amount after " + str(year) + " year(s) is $" + str(tuition))
Answer:
Study Python’s help on range to determine the names, positions, and what to do with your function’s parameters.
Use a default value of None for the two optional parameters. If these parameters both equal None, then the function has been called with just the stop value. If just the third parameter equals None, then the function has been called with a start value as well. Thus, the first part of the function’s code establishes what the values of the parameters are or should be. The rest of the code uses those values to build a list by counting up or down.
64 bit drivers must be certified in order to work.