Write a program to print the numbers 2 to 10 in increments of two on the same line. The output of your program should be 2 4 6 8 10

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 27PE
icon
Related questions
Question
100%

       use the c# programming language While and     For     loops

(Solve     using all       three loops),          you    may   code  all      three loops in        the     same project.       

 

//do-while loop int counter = 0, stop = 5;     //initializer do

{

 Console.WriteLine(counter); //code statement  counter++;                  //updater }while(counter < stop);       //checker

 

//while loop int counter = 0, stop = 5;    //initializer while(counter < stop)         //checker {

 Console.WriteLine(counter); //code statement  counter++;                  //updater }

 

//for loop

//      initializer           checker         updater for(int counter = 0, stop = 5;counter < stop; counter++) {

 Console.WriteLine(counter); //code statement }

 

  • Write a program to print the numbers 2 to 10 in increments of two on the same line. The output of your program should be 2 4 6 8 10
  • Write a Program to compute the sum of eight numbers. You will prompt the user for each number. Your prompt should also indicate which number is currently being accepted e.g. your prompt can be "Please enter value #5: "
  • Write a Program to compute the average of ten numbers. You will prompt the user for each number.
  • Write a C# program that displays a conversion table from gallons to liters. The program should display gallons from 10 to 20 in one-gallon increments and the corresponding liter equivalents. Use the relationship that 1 gallon contains 3.785 liters. Your table must look professional!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT