Computer Science, asked by AneekBiswas1, 11 months ago

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 nitish8089
8
code \:....................................
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();

}

}

}
for \: output \: check \: screenshot..........

hope it help's you :D
Attachments:

AneekBiswas1: Thanks for the program
AneekBiswas1: I will mark brainliest as soon as possible
nitish8089: my most welcome .... for you...
nitish8089: if any place you stuck tell out me may i help you to understand...
AneekBiswas1: Nope its clear and okay
nitish8089: ya ! i know but i don't know why this error shown.....
Similar questions
Math, 11 months ago