Q.
*
* *
* * *
* * * *
Solution :
class triangle
{
public static void main ( String args [ ] )
{
int i , j , k;
for( i =1 ; i < 5 ; i ++ )
{
for( j =1 ; j <5-i ; j++)
{
System.out.print(" ");
}
for( k =i ; k >0 ; k--)
{
System.out.print("* ");
}
System.out.println(" ");
}
}
}
*
* *
* * *
* * * *
Solution :
class triangle
{
public static void main ( String args [ ] )
{
int i , j , k;
for( i =1 ; i < 5 ; i ++ )
{
for( j =1 ; j <5-i ; j++)
{
System.out.print(" ");
}
for( k =i ; k >0 ; k--)
{
System.out.print("* ");
}
System.out.println(" ");
}
}
}
ITS REAlly helpful
ReplyDeletepublic class tt {
ReplyDeletepublic static void main(String[] args) {
for (int i=1; i<10; i += 2)
{
for (int k=0; k < (6- i /2); k++)
{
System.out.print(" ");
}
for (int j=0; j<i; j++)
{
System.out.print("*");
}
System.out.println("");
}
}
}
Thanks....its helpful..
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGreat post about Java Star Pattern Programs
ReplyDeletethanks
for(int i=1;i<=num;i++){
ReplyDeletefor(int j=num-i;j<num;j++){
System.out.print("*");
if(j==num-1){
for(int k=i;k<=j+1;k+=1){
System.out.print(" ");
}
for(int s=1;s<num-(i-1);s++){
System.out.print(" ");
}
for(int l=num-i;l<num;l++){
System.out.print("*");
}
}
System.out.println();
}
Any One give me this code in Java
ReplyDelete*
** **
*** ***
** **
*
How to Write this program to Print Star Pattern in Java
Really Nice Post to Print Star Pattern in Java Yesterday I visit this blog and i was found lots of helpful information from your side thanks for sharing updated and New Technology related Post.
DeleteReally Nice Post to Print Star Pattern in Java Yesterday I visit this blog and i was found lots of helpful information from your side thanks for sharing updated and New Technology related Post.
ReplyDelete