0% found this document useful (0 votes)
20 views

Star PatternRhombus in Java

The document describes a Java program that prints a star pattern in the shape of a rhombus. The program takes user input for the number of lines, then uses for loops and if/else statements to print spaces and asterisks in the correct format to create a rhombus shape that gets narrower toward the middle and then wider again on the other side. It provides the full Java code to implement this pattern printing program.

Uploaded by

chiraghz
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Star PatternRhombus in Java

The document describes a Java program that prints a star pattern in the shape of a rhombus. The program takes user input for the number of lines, then uses for loops and if/else statements to print spaces and asterisks in the correct format to create a rhombus shape that gets narrower toward the middle and then wider again on the other side. It provides the full Java code to implement this pattern printing program.

Uploaded by

chiraghz
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

hackingzo ne s.

co m

http://hackingzo nes.co m/?p=6228

Star Pattern(Rhombus) in java


import java.util.Scanner; class wo { int i,j,k,l,m,n; void wor() { System.out.println(enter no of line ); Scanner s1=new Scanner(System.com); n=s1.nextInt(); f or(i=1;i<=n;i++) { f or(k=1;k<=n-i;k++) { System.out.print( ); } f or(j=1;j<=i;j++) { System.out.print(*); } f or(l=2;l<=i;l++) { System.out.print(*); } System.out.print(\n); } f or(i=1;i<=n;i++) { f or(k=1;k<=i-1;k++) { System.out.print( ); } f or(j=i;j<=n;j++) { System.out.print(*); } f or(l=i+1;l<=n;l++) { System.out.print(*); } System.out.print(\n); } } } public class Star_Pattern { public static void main(String[] a) {

wo wobj=new wo(); wobj.wor(); } }

Relat ed Post
SHA1 Hash generating program in java MD5 Hash generating program in java Java Program to Find Network Interf ace Java Program to f ind Your IP Address and LoopBack Address Shif t Operator Program in Java Enter your email address:

Delivered by FeedBurner

Post Footer automatically generated by Add Post Footer Plugin f or wordpress.

You might also like