İç içe döngüler–JAVA

İç içe for döngülerinin kullanımı.

[pastacode lang=”java” manual=”package%20Unit4%3B%0A%0Apublic%20class%20Uint4Ex14%20%7B%0A%0A%09public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%09%09%2F%2F%20TODO%20Auto-generated%20method%20stub%0A%09%09for(int%20outer%3D1%3Bouter%3C5%3Bouter%2B%2B)%0A%09%09%7B%2F%2Fouter%20%3D1%2C2%2C3%2C4%20%20line1%204%0A%09%09%09for(int%20inner%3D1%3Binner%3C%3Douter%3Binner%2B%2B)%0A%09%09%09%7B%2F%2Finner%3D%201%2C1%2C2%2C1%2C2%2C3%2C1%2C2%2C3%2C4%20%20line2%2010%0A%09%09%09%09System.out.print(%22*%22)%3B%2F%2F%0A%09%09%09%7D%0A%09%09System.out.println()%3B%2F%2Fline%203%204%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A” message=”Nested Loop -Java” highlight=”” provider=”manual”/]

Ekran Çıktısı:

*

**

***

****

admin