Girilen 2 sayının 3'e ve 5'e Bölünebilirliğini Hesaplayan Program

  • Konbuyu başlatan Konbuyu başlatan Method
  • Başlangıç tarihi Başlangıç tarihi
20
EXE RANK

Method

Fexe Kullanıcısı
Puanları 0
Çözümler 0
Katılım
5 May 2010
Mesajlar
30,484
Tepkime puanı
0
Puanları
0
Yaş
34
Method
int toplam, sonuc = 0, top5 = 0, top3 = 0;
Console.Write("Bir sayı giriniz: ");
int sayi1 = Convert.ToInt32(Console.ReadLine());
Console.Write("bir sayı daha giriniz: ");
int sayi2 = Convert.ToInt32(Console.ReadLine());

for (toplam = sayi1; toplam < sayi2; toplam++)
if (toplam %5 == 0)
{
top5 = top5 + toplam;
}
else if (toplam %3 == 0)
{
top3 = top3 + toplam;
}
else
{
sonuc = sonuc + toplam;
}

Console.Write("3E bÖLünenLer : {0}\n5e BölüNenLer : {1}\n SayıLarın TopLamı : {2}",top3, top5, sonuc );
Console.ReadLine();
 
Geri
Üst