SIDEBAR
»
S
I
D
E
B
A
R
«
girilene kadar klavyeden sayı oku ve ortalamasını al
Tem 20th, 2010 by Özcan BAYĞUŞ

class Program
{
static void Main(string[] args)
{
Console.WriteLine(“-1 girilene kadar klavyeden sayı oku ve sayılatın ort al”);
double toplam = 0;
double ortalama = 0;
int sayi = 0;
int s=0;
do
{

toplam = toplam + sayi;

s++;
sayi = Convert.ToInt32(Console.ReadLine());
}
while (sayi!= -1);
if (s != 1)
{
ortalama = toplam / (s – 1);
}
Console.WriteLine(“ortalama=” + ortalama);
Console.ReadLine();

}
}
}

GİRİLEN SAYININ ASAL OLUP OLMADIĞINI BULAN PROGRAM
Tem 20th, 2010 by Özcan BAYĞUŞ

static void Main(string[] args)
{
int sayi = Convert.ToInt32(Console.ReadLine());
for(int i=2; i<=sayi; i++)
{
int kalan=sayi%i;
if(kalan==0)
{
Console.WriteLine("sayi asal değildir");
break;
}
if(i==sayi-1)
{
Console.WriteLine("sayi asaldir");
break;
}
}
Console.ReadLine();

}
}
}

Girilen sayının negatif mi pozitif mi olduğunu bulan program
Tem 20th, 2010 by Özcan BAYĞUŞ

static void Main(string[] args)
{
Console.WriteLine(“girilen sayının negatif veya pozitif olduğunu bulan”);
int x = Convert.ToInt32(Console.ReadLine());
if (x >= 0)
{
Console.WriteLine(“girilen sayı pozitiftir”);
}
else
{
Console.WriteLine(“girilen sayı negatif”);
}
Console.ReadLine();
}
}
}

girilen x değerini 5 kere ekrana yazdırma

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

namespace x_değerini_5_kere_yazdır
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(“x değerini 5 kez ekrana yazdır”);
int sayi = Convert.ToInt32(Console.ReadLine());
for (int index = 0; index < 5; index++)
{
Console.WriteLine(sayi);
}
Console.ReadLine();
}
}
}

İki sayı arasındaki çift sayılar
Tem 20th, 2010 by Özcan BAYĞUŞ

static void Main(string[] args)
{
int x;
int y;
int toplam = 0;
Console.WriteLine(“bir sayı girin”);
int input1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“bir sayı daha girin”);
int input2 = Convert.ToInt32(Console.ReadLine());
if (input1 > input2)
{
y = input1;
x = input2;
}
else
{
x = input1;
y = input2;
}
for (int s = x; s <= y; s = s + 1)
{
if (s % 2 == 0)
{
toplam = toplam + s;
}

Sayının Karesini Almak
Tem 1st, 2010 by Özcan BAYĞUŞ

int a=5;
Console.WriteLine((a*a).ToString());

»  Substance:WordPress   »  Style:Ahren Ahimsa