Write a Java program to assign a string and print it in the following way(ANSWER TRUTHFULLY AND LOGICALLY AND SPAMS WILL BE REPORTED)
COMPUTER
COMPUTE
COMPUT
COMPU
COMP
COM
CO
C
Answers
Answered by
8
public class Program
{
public static void main(String[] args) {
// assign the value of string COMPUTER:
String str="COMPUTER";
// printing the pattern using for loop:
for(int i=0;i<str.length();i++){
for(int j=0;j<(str.length()-i);j++)
{
System.out.print(str.charAt(j));
}
System.out.println();
}
}
}
hope it help's you :D
Attachments:

AneekBiswas1:
Thanks for the program
Similar questions