Ana sayfa Fortran Fortran 95 (Loops – Döngüler)

Fortran 95 (Loops – Döngüler)

700
52
PAYLAŞ

Bu yazımızda, Fortran dilindeki döngü kavramından söz edeceğiz. Döngü kavramı daha önce başka programlama dilleri hakkında bilgisi olanların muhakkak aşina olduğu bir kavramdır.

Fakat biz yine açıklayacak olursak, bir eylemi belirlediğimiz sınır boyunca (Sonsuz döngü istisnasını göz ardı edersek) tekrar tekrar gerçekleştirmemize yarayan bir fonksiyon türüdür.

Fortran’da üç çeşit döngü vardır. Bunlar sırasıyla,

  • do loop
  • do while loop
  • nested loops

do loop: Tanımlanan işleme göre, döngü başında bir sınama yapmadan tekrarlı bir döngü yaratmaya yarar.

do loop döngüsünün en genel formu:


do değişken = ilk_değer, son_değer, aralık

İşlem…

end do


Örnek olarak 0’dan 20’ye kadar 2’şer olarak sayan bir program yazalım.

 

do while döngüsü: Bir koşul sağlandığında bir ifadeyi veya ifade grubunu tekrarlayan döngü türüdür.

do while döngüsünün ana hatları aşağıdaki gibidir.


do while (koşul)

İşlemler…

end do


Örnek olarak kullanıcıdan girilen sayının faktöriyelini alan bir program yazarsak…

 

Son olarak nested loops‘a değinecek olursak, iç içe döngü yapılarını oluşturmak için kullanılır.

genel hatları ile şu şekilde tanımlanır.


değişken_türü :: ilk_döngü, ikinci_dongu,n.döngü

ilk_döngüloop: do ilk_döngü = başlangıç,bitiş

İşlem…

ikinci döngüloop: do ikinci_döngü = başlangıc,bitiş

İşlem…

n.döngüloop: do n.döngü=başlangıç,bitiş

end do n.döngü

end do ikinci_döngü

end do birinci_döngü


Basit bir örnek yaparsak…

 

Şu çıktıyı verir.

  • a: 1
  • b: 1
  • b: 2
  • b: 3
  • a: 2
  • b: 1
  • b: 2
  • b: 3
  • a: 3
  • b: 1
  • b: 2
  • b: 3

Bir sonraki yazımızda görüşmek üzere. 🙂

Kaynaklar:

https://www.fortrantutorial.com/loops/index.php

https://www.tutorialspoint.com/fortran/fortran_loops.htm

 

 


 

52 YORUMLAR

  1. I like what you guys are up also. Such smart work and reporting! Carry on the excellent works guys I have incorporated you guys to my blogroll. I think it will improve the value of my website :).

  2. you are really a good webmaster. The web site loading speed is incredible. It seems that you are doing any unique trick. Moreover, The contents are masterwork. you’ve done a excellent job on this topic!

  3. Hey there! I’m at work browsing your blog from my new apple iphone! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the excellent work!

  4. Howdy! Someone in my Facebook group shared this site with us so I came to give it a look. I’m definitely enjoying the information. I’m bookmarking and will be tweeting this to my followers! Fantastic blog and wonderful style and design.

  5. I loved as much as you’ll receive carried out right here.
    The sketch is tasteful, your authored material stylish. nonetheless, you command get got an edginess
    over that you wish be delivering the following.
    unwell unquestionably come more formerly again since exactly the same nearly very often inside
    case you shield this hike.

  6. I really enjoy looking through on this website, it has got superb content. “And all the winds go sighing, For sweet things dying.” by Christina Georgina Rossetti.

  7. Hello there, simply was aware of your blog via Google, and found that it’s truly informative. I am going to watch out for brussels. I’ll appreciate when you continue this in future. Numerous folks will be benefited out of your writing. Cheers!

  8. Thank you a bunch for sharing this with all people you actually recognize what you are speaking about!
    Bookmarked. Kindly also discuss with my website
    =). We could have a link exchange arrangement among us

  9. hello!,I like your writing so much! share we communicate more about your article on AOL? I need a specialist on this area to solve my problem. May be that’s you! Looking forward to see you.

  10. Hiya, I’m really glad I’ve found this information. Nowadays bloggers publish just about gossips and web and this is actually annoying. A good blog with interesting content, this is what I need. Thank you for keeping this web-site, I will be visiting it. Do you do newsletters? Can’t find it.

  11. Hi! This is my first visit to your blog! We are a group of volunteers and starting a new project in a community in the same niche. Your blog provided us beneficial information to work on. You have done a extraordinary job!

  12. I just wanted to develop a quick note in order to express gratitude to you for some of the fabulous strategies you are giving on this website. My rather long internet search has at the end been compensated with reliable strategies to share with my friends and family. I ‘d point out that most of us readers actually are very much endowed to dwell in a remarkable site with very many brilliant individuals with good tactics. I feel very much lucky to have encountered the website and look forward to some more cool moments reading here. Thank you once again for everything.

  13. Normally I do not learn article on blogs, but I wish to say that this write-up very forced me to take a look at and do so! Your writing taste has been surprised me. Thanks, quite nice article.

  14. Hi! I’m at work browsing your blog from my new iphone 4! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the superb work!

  15. Excellent site. Plenty of helpful information here. I am sending it to a few friends ans additionally sharing in delicious. And obviously, thank you to your effort!

  16. Along with the whole thing that seems to be building throughout this particular area, many of your perspectives are generally very refreshing. Having said that, I appologize, because I can not give credence to your entire suggestion, all be it refreshing none the less. It seems to us that your comments are not entirely validated and in actuality you are generally yourself not even completely convinced of the argument. In any event I did take pleasure in reading it.

  17. When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!

  18. You made some first rate points there. I appeared on the web for the difficulty and found most people will associate with together with your website.

  19. hey there and thank you to your info – I’ve definitely picked up something new from right here. I did then again expertise several technical points the use of this web site, as I skilled to reload the web site many instances prior to I may just get it to load correctly. I had been thinking about if your web host is OK? No longer that I am complaining, but sluggish loading circumstances occasions will often affect your placement in google and can damage your high quality ranking if advertising and ***********|advertising|advertising|advertising and *********** with Adwords. Anyway I’m including this RSS to my email and could look out for a lot extra of your respective intriguing content. Make sure you update this once more very soon..

  20. Hey very cool web site!! Man .. Beautiful .. Amazing .. I will bookmark your web site and take the feeds also…I am happy to find a lot of useful information here in the post, we need work out more techniques in this regard, thanks for sharing. . . . . .

  21. I think other site proprietors should take this site as an model, very clean and fantastic user friendly style and design, let alone the content. You are an expert in this topic!

  22. An interesting discussion is worth comment. I think that you should write more on this topic, it might not be a taboo subject but generally people are not enough to speak on such topics. To the next. Cheers

  23. You can definitely see your expertise in the work you write. The world hopes for more passionate writers like you who are not afraid to say how they believe. Always follow your heart.

  24. I’ll right away take hold of your rss as I can not in finding your email subscription link or newsletter service. Do you have any? Please allow me know so that I may subscribe. Thanks.

  25. Wow! This could be one particular of the most useful blogs We’ve ever arrive across on this subject. Basically Fantastic. I am also an expert in this topic therefore I can understand your hard work.

  26. you are really a good webmaster. The website loading speed is amazing. It seems that you are doing any unique trick. Also, The contents are masterpiece. you have done a magnificent job on this topic!

  27. There are some attention-grabbing deadlines in this article but I don’t know if I see all of them middle to heart. There’s some validity however I’ll take hold opinion till I look into it further. Good article , thanks and we wish extra! Added to FeedBurner as properly

BİR CEVAP BIRAK

Lütfen yorumunuzu giriniz
Buraya isminizi giriniz