WAP to input a string and display it as follows using
for-loop:
Input: apple
Output:
apple
appleapple
appleappleapple
appleappleappleapple
appleappleappleappleapple
Answers
Answered by
16
import java.util.*;
public class Stringpattern
{
public static void main(String args[])
{
int i,j;String s;
Scanner sc=new Scanner(System.in);
System.out.println("Enter a string");
s=sc.next();
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
System.out.print(s);
System.out.println();
}
}
}
Answered by
1
Answer:
I have pinned the answer image you can check it out dear
Hope you may get it
Mark as brainliest
Thank You...
Attachments:
Similar questions