Click here to Skip to main content
15,393,863 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
why spaces are not adding in sop("")

What I have tried:

for(int i=5;i>0;i--)
     
{
	for (int j=0; j<=i; j++)
	{
		System.out.print("") ;
		
	}
		System.out.println("*") ;
		
}
Posted
Updated 10-Sep-21 6:45am
v2
Comments
OriginalGriff 10-Sep-21 9:11am
   
We can't tell - your code is truncated and we can't read much of it at all.

Use the "Improve question" widget to edit your question and provide better information.
Patrice T 10-Sep-21 9:39am
   
Part of your code is missing.

1 solution

Because there is no space in your string: it's an empty string: "" where you need at least one space: " ":
Java
System.out.print(" ") ;
   
v2
Comments
Pocket FM - Fir Milenge 10-Sep-21 13:00pm
   
thanks
OriginalGriff 10-Sep-21 13:05pm
   
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900