Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inverted pyramid using * and digits #59

Open
sujana-kamasany opened this issue Feb 14, 2022 · 2 comments
Open

inverted pyramid using * and digits #59

sujana-kamasany opened this issue Feb 14, 2022 · 2 comments
Labels
good first issue Good for newcomers Hacktoberfest-Accepted Make your Pull Request for Hacktoberfest 2023 Java Basic Java Programs

Comments

@sujana-kamasany
Copy link
Owner

Add Java Program to print inverted pyramid using * and digits

image

@sujana-kamasany sujana-kamasany added good first issue Good for newcomers Java Basic Java Programs labels Feb 14, 2022
@DHARUNKUMAR7
Copy link
Contributor

My ans:
public class Main {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int a = in.nextInt();
for(int i = 0 ; i < a; i++){
for(int j = 0 ; j < i ;j++){
System.out.print(" ");
}
for (int j = 0; j < a - i; j++) {
System.out.print("* ");
}
for (int j = 0; j < a - 1 - i; j++) {
System.out.print("* ");
}
System.out.println();
}
}
}

@sujana-kamasany
Copy link
Owner Author

@DHARUNKUMAR7 thank you for the code! please go ahead and make a pull request

@sujana-kamasany sujana-kamasany added the Hacktoberfest-Accepted Make your Pull Request for Hacktoberfest 2023 label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Hacktoberfest-Accepted Make your Pull Request for Hacktoberfest 2023 Java Basic Java Programs
Projects
None yet
Development

No branches or pull requests

2 participants