{"id":563,"date":"2018-12-30T21:07:21","date_gmt":"2018-12-30T18:07:21","guid":{"rendered":"http:\/\/www.aydiner.gen.tr\/?page_id=563"},"modified":"2018-12-30T21:07:21","modified_gmt":"2018-12-30T18:07:21","slug":"c-console-while-dowhile-dongusu","status":"publish","type":"page","link":"https:\/\/www.aydiner.gen.tr\/index.php\/c-console-while-dowhile-dongusu\/","title":{"rendered":"C# Console  While, Do\u2026While D\u00f6ng\u00fcs\u00fc"},"content":{"rendered":"<p>While d\u00f6ng\u00fcs\u00fc i\u00e7erisindeki sat\u0131rlar&nbsp; ko\u015ful do\u011fru(true) oldu\u011fu s\u00fcrece tekrar eder. D\u00f6ng\u00fc ko\u015fulu yanl\u0131\u015f (false) oldu\u011funda d\u00f6ng\u00fc \u00e7al\u0131\u015fmas\u0131 sona erer.<\/p>\n<p><b>Not :&nbsp;&nbsp;<\/b>while d\u00f6ng\u00fcs\u00fcnde ko\u015ful parentez i\u00e7erisinde belirtilir. ve bu sat\u0131rda&nbsp;<b>noktal\u0131 virg\u00fcl<\/b>&nbsp;(<b>;<\/b>) kullan\u0131lmaz<\/p>\n<pre class=\"lang:default decode:true \">\/\/1 ile 10 aras\u0131ndaki say\u0131lar\u0131 ekrana alt alta while d\u00f6ng\u00fcs\u00fc ile yazd\u0131r\u0131n\u0131z.\r\n\r\nint say=1;  \r\nwhile(say&lt;=10)   \/\/ bu sat\u0131rda noktal\u0131 virg\u00fcl kullan\u0131lmad\u0131g\u0131na dikkat ediniz !  \r\n{  \r\n  Console.WriteLine(say);  \r\n  say++;  \r\n}  \r\nConsole.ReadKey();<\/pre>\n<pre class=\"lang:default decode:true \">\/\/1 ile 10 aras\u0131ndaki tek say\u0131lar\u0131 ekrana alt alta while d\u00f6ng\u00fcs\u00fc ile yazd\u0131r\u0131n\u0131z.\r\n\r\nint say=1;  \r\nwhile(say&lt;=10)  \r\n{  \r\n  Console.WriteLine(say);  \r\n  say+=2; \/\/ art\u0131\u015f miktar\u0131 2 yap\u0131larak tek say\u0131lar elde edilebilir  \r\n}  \r\nConsole.ReadKey();<\/pre>\n<pre class=\"lang:default decode:true \">\/\/Bilgisayara rastgele \u00fcrettirdi\u011fimiz bir say\u0131y\u0131 5 hakta tahmin etmeye\r\n\u00e7al\u0131\u015fan bir bilgisayar program\u0131 yaz\u0131n\u0131z.\r\n\r\nint hak = 5;\r\nRandom rnd = new Random();\r\nint tutulan = rnd.Next(1, 50);\r\nint sayi=0;\r\nwhile (hak&gt;0)\r\n{\r\nConsole.Write(\"Bir say\u0131 giriniz: \");\r\nsayi = Convert.ToInt32(Console.ReadLine());\r\nhak = hak - 1;\r\nif (sayi == tutulan)\r\n{\r\nConsole.WriteLine(\"Tebrikler say\u0131y\u0131 do\u011fru tahmin\r\nettiniz\");\r\nbreak;\r\n}\r\nelse\r\n{\r\nif (sayi &gt; tutulan)\r\nConsole.WriteLine(\"A\u015fa\u011f\u0131\");\r\nelse\r\nConsole.WriteLine(\"Yukar\u0131\");\r\n}\r\nConsole.WriteLine(\"Kalan tahmin hakk\u0131n\u0131z:{0}\", hak);\r\n}\r\nif(hak==0)\r\nConsole.WriteLine(\"Tahmin hakk\u0131n\u0131z bitti.\r\nSay\u0131m\u0131z:{0}\",tutulan);<\/pre>\n<p>Do\u2026While D\u00f6ng\u00fcs\u00fc For ve while d\u00f6ng\u00fclerinde d\u00f6ng\u00fc bloklar\u0131n\u0131n ko\u015ful sa\u011flanmad\u0131\u011f\u0131 takdirde hi\u00e7 \u00e7al\u0131\u015ft\u0131r\u0131lmama ihtimali vard\u0131r. Ancak d\u00f6ng\u00fcn\u00fcn en az bir kere \u00e7al\u0131\u015ft\u0131r\u0131lmas\u0131 istenilen durumlarda do-while d\u00f6ng\u00fcleri kullan\u0131l\u0131rlar. Do-While d\u00f6ng\u00fclerinde ko\u015ful d\u00f6ng\u00fc i\u00e7erisindeki i\u015flemler bir kez ger\u00e7ekle\u015ftirildikten sonra kontrol edilir. Ko\u015ful do\u011fru oldu\u011fu m\u00fcddet\u00e7e de d\u00f6ng\u00fc i\u00e7erisindeki i\u015flemler tekrarlanmay\u0131 s\u00fcrd\u00fcr\u00fcr.<\/p>\n<pre class=\"lang:default decode:true \">do\r\n{\r\nyap\u0131lacak i\u015fler;\r\n}\r\nwhile(ko\u015ful);<\/pre>\n<pre class=\"lang:default decode:true \">\/\/1\u2019den 20\u2019ye kadar olan tek say\u0131lar\u0131 ekrana yazd\u0131r\u0131n\u0131z.\r\nint i=1;\r\ndo{\r\nConsole.WriteLine(i);\r\ni = i + 2;\r\n} while (i &lt; 20);<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While d\u00f6ng\u00fcs\u00fc i\u00e7erisindeki sat\u0131rlar&nbsp; ko\u015ful do\u011fru(true) oldu\u011fu s\u00fcrece tekrar eder. D\u00f6ng\u00fc ko\u015fulu yanl\u0131\u015f (false) oldu\u011funda d\u00f6ng\u00fc \u00e7al\u0131\u015fmas\u0131 sona erer. Not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-563","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/pages\/563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/comments?post=563"}],"version-history":[{"count":0,"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/pages\/563\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.aydiner.gen.tr\/index.php\/wp-json\/wp\/v2\/media?parent=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}