Q:

Write an application named Sum200 that sums the integers from 1 through 200. Display the running total when the program is halfway complete (after the first 100 numbers), and at the end

0

Write an application named Sum200 that sums the integers from 1 through 200. Display the running total when the program is halfway complete (after the first 100 numbers), and at the end.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;

namespace _9_Sum200
{
    class Sum200
    {
        static void Main(string[] args)
        {
            WriteLine("Sum200");

            int itr = 0;
            int sum = 0;
            while (itr <= 200)
            {
                sum += itr;
                if (itr >= 100)
                    Console.WriteLine(sum);
                ++itr;
            }

            WriteLine("--End--");
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now