Computer Science, asked by pk566799, 1 year ago

java program to display the series :
c
co
com
comp
compu
comput
compute
computer

Answers

Answered by QGP
12
Here's the code:



public class Pattern
{
    public static void main(String[] args)
    {
        String str = "computer";
       
        for(int i=1;i<=str.length();i++)
        {
            System.out.println(str.substring(0,i));
        }
    }
}



Here, str.length() gives the length of str string. 

And, str.substring(0,i) extracts the substring of str starting from index position 0 to index position i. i is the loop variable.


Hope it helps
Purva
Brainly Community
Answered by SƬᏗᏒᏇᏗƦƦᎥᎧƦ
18

ANSWER IS IN PIC OF MY COMPUTER SEE

Attachments:
Similar questions