Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ardamavi/752622e20c63a867fb5d to your computer and use it in GitHub Desktop.

Select an option

Save ardamavi/752622e20c63a867fb5d to your computer and use it in GitHub Desktop.
C# ile Forumdan sorulan küçük algoritma sorusunu cevaplıyorum.
using System;
namespace ArdaMavi
{
class MainClass
{
public static void Main (string[] args)
{
// Arda Mavi
for(int i = 0; i<=4;i++){
// i bir tamsayı ve 0 değerine eşit. Döngü, i 4'e eşit ya da 4'den küçük olana kadar devam edecek. i sayısı her tekrarda 1 arttırılacak.
int c = 31;
// c sayısı 31'e eşit
for(int b = 0; b<=i ;b++){
// b bir tamsayı ve 0 değerine eşit. Döngü, b, i'ye eşit ya da i'den küçük olana kadar devam edecek. b sayısı her tekrarda 1 arttırılacak.
Console.Write(c + " ");
// c ekrana yazdırılacak ve bir boşluk bırakılacak.
c = c-6;
// c'den 6 çıkarılıp c'ye atanacak.
}
Console.Write("\n");
// Yeni satıra geçmek için.
}
/*
Konsol çıktısı :
31
31 25
31 25 19
31 25 19 13
31 25 19 13 7
*/
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment