Focus mode
Java'da döngüler kullanılarak yıldızlar ile üçgen yapıyoruz.
*
***
*****
*******
*********
***********
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner klavye = new Scanner(System.in);
System.out.println("Bir Sayı Giriniz :");
int n = klavye.nextInt();
for (int i = 0; i <= n ; i++) {
for (int j = 0; j < (n - i); j++) {
System.out.print(" ");
}
for (int k = 1; k <= (2 * i + 1); k++) {
System.out.print("*");
}
System.out.println(" ");
}
}
}
Java'da döngüler kullanarak yıldızlar ile elmas yapınız.
*
***
*****
*******
*********
*******
*****
***
*
For a quick start in software development from scratch, check out our specialized training courses
Do you need more education, projects, and mentor support in your journey to learn programming? Join Patika+'s intensive 4-8 month bootcamps, gain all the necessary skills with project-based live classes and customized trainings for you, and start your career!
You need to enroll in the course to be able to comment!