Question: For the first question i need to do it three times With, while,for and do while For each exercise, include the program along with comments,
For each exercise, include the program along with comments, and a creenshot of the console, 5-1: Counting with Loops Write a program that inputs a number greater than or equal to 0. The program should then count from 0 to the number inputted using a for-loop, a while-loop, and a do..while loop. If the user's input is not greater than or equal to 0, display an error message and require the user to try again until they get it right. 5-2: Factorial Let n be a nonnegative integer. The factorial of n, written n! is defined by 0!-1, n! 1 .2.3 . . . n if n 2 1 . For example, 4. = 1-2-3-4-24, write a program that prompts the user to enter a nonnegative integer and outputs the factorial of the number, then find the approximate value of the number e using the read input as n in the approximating equation below t! e is an irrational mumber 2.718281827. used in exponential growth and decay problems)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
