Pls help code a program to print the numerals 15 to 1 on screen. Use a loop to control the printing | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pls help code a program to print the numerals 15 to 1 on screen. Use a loop to control the printing

2nd Dec 2021, 8:17 AM
Naziru
Naziru - avatar
3 Answers
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.
2nd Dec 2021, 8:25 AM
Carbon
Carbon - avatar
0
thanks friend
2nd Dec 2021, 8:26 AM
Naziru
Naziru - avatar
0
pls can we chat
2nd Dec 2021, 8:31 AM
Naziru
Naziru - avatar