The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Â
int main()
{
    // declare variables:
int n1, n2;
int option = 0;
// declare more variables as needed.
Â
// Prompt the user for two whole numbers such that n1 < n2.
    Validation: Keep prompting the user until the user enters 2 numbers in proper order.
               Â
              // Display the menu of options (see above).
              // Prompt the user to select an option. Read it into variable option.
Â
              // Use  switch statement to process the selected option.  Â
              // Option-1: Write a while loop to display numbers n1 to n2.
              // Option-2: Write a for loop to display the even numbers from n1 to n2.
              // Option-3: Write a for loop to add up all the numbers from n1 to n2. Display the sum.
              // Option-4: if n1 is less than 9 and greater than 0, write a for loop to compute n1factorial.
                                   NOTE: n1 factorial is 1 * 2 * 3 ….* n1. By definition 0! Is equal to 1.
               // Option-5: Display numbers in reverse order, n2 to n1.                                 Â
               // Option-6: Thank the user and end the program.
               // default: Invalid option.
Â
      _getch();
       return 0;
     }
Attachments:
-----------