Question

Programming Question C#. please help by showing your work Convert the following while loop to an...

Programming Question C#. please help by showing your work

Convert the following while loop to an equivalent for loop.

   int counter = 1;

     while (counter <= 10)

        {

        WriteLine(counter);

        counter++;

        } // End while

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

for(int counter = 1;counter <= 10;counter++;)
{
    WriteLine(counter);
} // End for

Add a comment
Know the answer?
Add Answer to:
Programming Question C#. please help by showing your work Convert the following while loop to an...
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
  • FOR C# PROGRAM Convert the following for loop to a while loop: for (int counter=0; counter<101;...

    FOR C# PROGRAM Convert the following for loop to a while loop: for (int counter=0; counter<101; counter++) { sum += counter; }

  • using C++ 1. Convert the following while loop into a for loop: int count = 0;...

    using C++ 1. Convert the following while loop into a for loop: int count = 0; while (count < 10) x = count + sin(x); y = count + cos(y); count++;

  • Convert the following while loop into a for loop. int 1 - 50: int sum-07 while...

    Convert the following while loop into a for loop. int 1 - 50: int sum-07 while (sum < 1000) sum - sum + 1; Question 35 (2 points) Saved Given an int variable k that has already been declared, use a while loop to print a single line consisting of 80 dollar signs. Use no variables other than k. int sum = 0; for(int i = 100;sum < 10000;1-- sum = sum + i;

  • Programming language: C NOT c++ Problem 2 (20 points) Both the for loop and the do-while...

    Programming language: C NOT c++ Problem 2 (20 points) Both the for loop and the do-while loop can be transformed into a simple while loop. For each of the following examples a) and b), write equivalent code using a while loop instead. double rand_double)( double ret - (double)rand(); return ret/ (RAND MAX 1); int factorial (int n) int for i, ret =1; (i=2; i <= ret *= 1; n; i++) int sample_geometric_rv(double p)l double q return ret; int ne; do...

  • need help understanding (C#) please include your work ⦁   In general, what is printed by the...

    need help understanding (C#) please include your work ⦁   In general, what is printed by the following C# program? class Demo { static void Main(string[] args) { for (int i = 0; i < args.Length; i++) WriteLine(args[i]); } // End Main } // End class

  • 11) 16 pts. Convert the following for loop to a while loop. (You may want to...

    11) 16 pts. Convert the following for loop to a while loop. (You may want to do the following question first.) int mine [5] = {10, 11, 12); for (int j=1; j < 5; j++) cout <<j<< "" << mine[jl <<" " << end1; 12) 6 pts. What is the output of the previous question? 13) 4 pts. Circle the variables that would NOT cause syntax errors 2-smaTT , entry# break -my-int

  • Q. 07 (2 points) Convert the following while loop to a for loop: int count =...

    Q. 07 (2 points) Convert the following while loop to a for loop: int count = 0; while (count<50) cout<<"count iscounts endl count+

  • c++ convert do while loop below to a for loop #define MAX VALUE 5 #define START...

    c++ convert do while loop below to a for loop #define MAX VALUE 5 #define START VALUE 5 //START_VALUE always <-MAX VALUE int main() convert do while loop below to a for loop int j - MAX VALUE; do cout <<<<endl; ; while > 0); I

  • convert nested for loop into nested while loop please: int[][] sol = new int[rows + 2][columns...

    convert nested for loop into nested while loop please: int[][] sol = new int[rows + 2][columns + 2];                 for (i = 1 ; i <= rows ; i++)                     {                         for (j = 1 ; j <= columns ; j++)                             {                                     // (ii, jj) indexes neighboring cells                                 for (int ii = i - 1 ; ii <= i + 1 ; ii++)                                     {                                         for (int jj = j - 1 ; jj <=...

  • C programming only please 5.2.3: Printing array elements with a for loop. Write a for loop...

    C programming only please 5.2.3: Printing array elements with a for loop. Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10}, print: 7 9 11 10 10 11 9 7 Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1. (Notes) Note: These activities may test code with...

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