0
Pls help code a program to print the numerals 15 to 1 on screen. Use a loop to control the printing
3 odpowiedzi
0
Your question is not clear enough but if you mean a program that outputs all numbers from 15 to 1 using a loop then here:
------------------------------
#include <iostream> // Input & output library (necessary)
using namespace std; // To get rid of "std::" usage
int main() { // Main function
int number = 15; // Declare a integer variable with 15 stored in it
while(number > 0) // A while loop that checks if "number" is greater than 0
{
cout << number << endl; // Prints "number"
number--; // Decreases "number" by one
}
return 0; // Kills the program
}
------------------------------
And please next time show us your work, you cannot rely on people doing your work forever. Try doing it yourself at least once then you may ask for help.
0
thanks friend
0
pls can we chat