Question #47787

Generate the series 3 6 9 2 5 8 1 4 7 0 using using loop in c #

Expert's answer

Answer on Question #47787 - Programming, C#

Generate the series 3 6 9 2 5 8 1 4 7 0 using using loop in c #

Solution.

// Connecting library
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NewApp
{
    class Program
    {
        static void Main(string[] args)
        {
            //3 6 9 2 5 8 1 4 7 0
            for (int k = 3, j = 0, i = k, n = 12; i <= n; i += 3, j++)
            {
                if (j == 3) { j = 0; n--; k--; i = k; }
                if (i == -1) { break; }
                Console.Write(i + " ");
            }
            Console.Read();
        }
    }
}


http://www.AssignmentExpert.com/

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS