19 Kasım 2009 Perşembe

C# While Döngüsü

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// 0-100 arasındaki tek sayıların toplamını bulan program

int i = 1;
int toplam = 0;

while (i <= 100)
{
toplam += i;
i += 2;
}

Console.WriteLine("0-100 arsındaki tek sayıların toplamı: {0}", toplam);

}
}
}

Hiç yorum yok:

Yorum Gönder