Question

C++ Code Writing Prompt: Countdown: Write a countdown program that prompts the user for a max...

C++ Code Writing Prompt:

Countdown: Write a countdown program that prompts the user for a max value (i.e. 30). Print out a countdown from that number down to zero, then print “blast off!”

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code:

#include<iostream>
using namespace std;
int main()
{
int n,i;
cout << "Enter a number which is less than 30 :";
cin >> n;
if(n>30)
{
cout<<"Enter a number less than 30";
}
for(i=n;i>=0;i--)
{
cout<<i<<" "<<"\n";
}
cout<<"blast off!";
return 0;
}
using namespace std; 3 int main() 4-{ 5 int n,i; 6 cout << Enter a number which is less than 30 :; 7 cin >> n; 8 if(n>30) 9
  Enter a number which is less than 30 :10 10 9 8 < 7 6 5 4 3 2 1 0 blast off!

Add a comment
Know the answer?
Add Answer to:
C++ Code Writing Prompt: Countdown: Write a countdown program that prompts the user for a max...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ please (1) Write a program that prompts the user to enter an integer value N...

    c++ please (1) Write a program that prompts the user to enter an integer value N which will rpresent the parameter to be sent to a function. Use the format below. Then write a function named CubicRoot The function will receive the parameter N and return'its cubic value. In the main program print the message: (30 Points) Enter an integer N: [. ..1 The cubic root of I.. ] is 2 update the code om part and write another function...

  • Write a C++ program that prompts the user to enter two numbers. Then prompt the user...

    Write a C++ program that prompts the user to enter two numbers. Then prompt the user to select from the following options: a. Add the numbers. b. Multiply the numbers. c. Terminate the program Use the appropriate control structures (loops, if else, switch-case, etc) to make your program as short and efficient as possible. Minor syntax errors are forgiven in this exercise; just focus on the correct structure, declarations and sequence of instructions

  • Write a C++ Program Write a program that prompts the user to input a number. The...

    Write a C++ Program Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive, negative, or zero. You must insert the following comments at the beginning of your program and write our commands in the middle: Write a C++ Program: 1 Name: Your Name ID: Your ID #include <iostream> using namespace std; din main YOUR CODE HERE

  • Write code that prompts the user to input a number. The program should then output the...

    Write code that prompts the user to input a number. The program should then output the number and a message saying whether the number i "Positive, "Negative" or "Zero". It should further output whether the number is odd or even (zero is counted as even) For example:

  • write a c++ program that prompts a user for a number then attempts to allocate an...

    write a c++ program that prompts a user for a number then attempts to allocate an array of as many integers as the user enters. In other words, the program might prompt the user with a line like: “How many integers would you like to allocate?” It should then allocate as many integers as the user enters. The program should then wait for the user to press enter before deleting the allocated array and quitting. We will use this time...

  • Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display...

    Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display the numbers in 3 formats. Then check, whether the larger of the 2 is evenly divisible by the smaller. Detail: Write a complete C program, more complex than the typical "hello world" program. Prompt the user to enter 2 integer numbers that are not negative. After either entry, display that number again. Print the smaller in hexadecimal, in decimal, and in octal format. Include...

  • Help with a C code! Multidimensional Array problem: a) prompt the user for the number of...

    Help with a C code! Multidimensional Array problem: a) prompt the user for the number of rows they want. Then, print an array of stars. For example, if user prompts "5", the output should look like: * * * * * * * * * * * * * * * b) Do the same, but inverse the table. If user types 5 for their prompt, output will look like: * * * * * * * * * *...

  • c++ Write a program that prompts the user to enter a length in feet and then...

    c++ Write a program that prompts the user to enter a length in feet and then enter a length in inches and outputs the equivalent length in centimeters. If the user enters a negative number or a non-digit number, throw and handle an appropriate exception and prompt the user to enter another set of numbers. Your error message should read A non positive number is entered and allow the user to try again.

  • .Write a program to prompt the user for a file name and a linenumber...

    Write a program to prompt the user for a file name and a line number and then print only that line from the file. Consider possible difficulties and include code to address them. [Hints: it is important to clearly define what you think “line” means. Also, there are a number of errors to consider trapping.]

  • write a c program for the above Write a program which prompts the user to enter...

    write a c program for the above Write a program which prompts the user to enter three integers (data type int) and then calculates the arithmetic average as a decimal number and prints the value with two decimal digits. If you have time also calculate and print the harmonic mean of the same numbers according to the following formula: 3. PT harmonic _mean-1 1 22x (Test with integer values of 4, 7, and 8. You may submit one program per...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT