Skip to content

Instantly share code, notes, and snippets.

@mrnirva
Created September 4, 2020 12:01
Show Gist options
  • Save mrnirva/13772b5b8ffbcd0c130772ce3598f389 to your computer and use it in GitHub Desktop.
Save mrnirva/13772b5b8ffbcd0c130772ce3598f389 to your computer and use it in GitHub Desktop.
package donguler;
public class Donguler {
public static void main(String[] args) {
// 10'dan Geriye Sayan Örnek
for(int i=10; i>0; i--){
System.out.println(i);
}
System.out.println("*************************");
// Çift Sayıları Yazdıran Örnek
for(int i=0; i<15; i+=2){
System.out.print(i + " ");
}
System.out.println("\n*************************");
int toplam = 0;
// Dışarıdan verilen değişkenle sayacı toplamak
for(int i=0; i<1000; i++){
toplam += i;
}
System.out.println("Toplam: "+toplam);
System.out.println("*************************");
int toplamIcIce = 0;
// İç içe for döngüsü
for(int i=0; i<10; i++){
// Her defasında 10 kez buraya girer
for(int j=0; j<10; j++){
toplamIcIce += i + j;
}
}
System.out.println("Toplam İç İçe: "+toplamIcIce);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment