Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java program to print a given pattern. (stars)
Following is a Java program which prints a pyramid of numbers.
Example
public class PrintingPyramidStars {
public static void main(String args[]){
int n,i,j;
n = 5;
for(i = 0; i<= n; i++) {
for(j = 0; j<= i; j++){
System.out.print("*"+" ");
}
System.out.print("\n");
}
}
}
Output
* * * * * * * * * * * * * * * * * * * * *
Advertisements