The for Loop Solutions - D Programming Language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Discord (community-run)
  - Forums
  - IRC
  - Wiki
  - Issues
  - Contributing
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# The for Loop Solutions

#### The `for` Loop Dersi Problem Çözümleri

1.     import std.stdio;

       void main() {
           for (int line = 0; line != 9; ++line) {
               for (int column = 0; column != 9; ++column) {
                   write(line, ',', column, ' ');
               }

               writeln();
           }
       }

2. Triangle:

       import std.stdio;

       void main() {
           for (int line = 0; line != 5; ++line) {
               int length = line + 1;

               for (int i = 0; i != length; ++i) {
                   write('*');
               }

               writeln();
           }
       }

   Parallellogram:

       import std.stdio;

       void main() {
           for (int line = 0; line != 5; ++line) {
               for (int i = 0; i != line; ++i) {
                   write(' ');
               }

               writeln("********");
           }
       }

   Can you produce the diamond pattern?

Copyright © 1999-2026 by the D Language Foundation | Page generated by Ddoc on Wed Aug 19 13:28:51 2026