answersLogoWhite

0


Best Answer

String hello = "hello";

for(int i = 0; i < hello.length(); i++){

System.out.print(hello.substring(0,i+1));

}

/*

* This loop will loop over the string "hello". For each loop it will print

* the entire string from the beginning to the index of i. Therefore, the

* first loop will print hello.substring(0,1), or "h". The next loop will

* print hello.substring(0,2) or "he". These are all printed together so

* it becomes "hhehelhellhello"

*/

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

6y ago

char str[] = "hello"; for (int i=1; i<=5; ++i) for (int j=0; j<i; ++j) printf ("%c", str[j]);

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In PHP How do you print this pattern h h e h e l h e l l h e l l o?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Programme in basic to sum of first 10 numbers?

If you wish to sum every number as you go along:10 LET A=120 PRINT A30 LET B=A+140 PRINT A+B50 LET C=B+160 PRINT A+B+C70 LET D=C+180 PRINT A+B+C+D90 LET E=D+1100 PRINT A+B+C+D+E110 LET F=E+1120 PRINT A+B+C+D+E+F130 LET G=F+1140 PRINT A+B+C+D+E+F+G150 LET H=G+1160 PRINT A+B+C+D+E+F+G+H170 LET I=H+1180 PRINT A+B+C+D+E+F+G+H+I180 LET J=I+1190 PRINT A+B+C+D+E+F+G+H+I+J200 STOP


Who is Antti H?

He's the official solar-php fanboy.


How do you get print?

h


What comes after a e f h I s?

The sequence after e f h I s is not standard or clear. Additional context or information is needed to determine the pattern or next item in the sequence.


What are some eight letter words with 1st letter E and 4th letter H and 5th letter E and 8th letter H?

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 1 words with the pattern E--HE--H. That is, eight letter words with 1st letter E and 4th letter H and 5th letter E and 8th letter H. In alphabetical order, they are: ensheath


What are some nine letter words with 1st letter H and 2nd letter E and 4th letter H and 8th letter E?

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 1 words with the pattern HE-H---E-. That is, nine letter words with 1st letter H and 2nd letter E and 4th letter H and 8th letter E. In alphabetical order, they are: henhouses


Is there a website where you can print out the The Midnight Sun manuscript cause it a pain having to read it on the computer?

I know what you mean, but no, there is no website where you can print it out! The only way you can read the first twelve chapters is from Stephanie Meyer's website, on the adobe reader. Believe me, I've looked e-v-e-r-y-w-h-e-r-e for it!


What are some eight letter words with 1st letter H and 4th letter H and 6th letter E and 8th letter H?

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 1 words with the pattern H--H-E-H. That is, eight letter words with 1st letter H and 4th letter H and 6th letter E and 8th letter H. In alphabetical order, they are: hasheesh


What are some seven letter words with 2nd letter H and 4th letter E and 6th letter H?

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 2 words with the pattern -H-E-H-. That is, seven letter words with 2nd letter H and 4th letter E and 6th letter H. In alphabetical order, they are: wheechs wheesht


What are some nine letter words with 2nd letter H and 4th letter H and 9th letter E?

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 1 words with the pattern -H-H----E. That is, nine letter words with 2nd letter H and 4th letter H and 9th letter E. In alphabetical order, they are: phthalate


What are some six letter words with 1st letter E and 3rd letter E and 6th letter H?

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 1 words with the pattern E-E--H. That is, six letter words with 1st letter E and 3rd letter E and 6th letter H. In alphabetical order, they are: elench


What are some six letter words with 2nd letter E and 4th letter E and 6th letter H?

According to SOWPODS (the combination of Scrabble dictionaries used around the world) there are 1 words with the pattern -E-E-H. That is, six letter words with 2nd letter E and 4th letter E and 6th letter H. In alphabetical order, they are: secesh