Computer Science, asked by abhiaekhdutta98, 2 months ago

write a program to print the following pattern of blue j. please give me the correct answer my exams are near .​

Attachments:

Answers

Answered by BrainlyProgrammer
6

Answer:

This can be solved using charAt( )

______________

Note:-

  1. charAt() is used for extracting the charter at a particular position(here,index of string)
  2. String index starts from 0 to n-1 where n is the no. of characters. This is the reason why loop is starting from 0.
  3. print() will print in same lines
  4. println() will print in different lines

________

Variable Description:-

  1. str:- to store string data
  2. i:- loop variable
  3. j:- loop variable

_

•Output Attached

Attachments:
Answered by Oreki
6

\textsf{\Large \textbf{Methods Used}}

   \textsf{\large - charAt(\textbf{int} i)}

          \textsf{Returns the character at the specified location \textbf{i}.}

   \textsf{\large - r \hspace{-.67em} epeat(\textbf{int} count)}

          \textsf{Returns a string whose value is the concatenation of the string r \hspace{-.67em} epeated.}

\textsf{\Large \textbf{Algorithm}}

  • \textsf{\large Iterating over the String and obtaining each character.}
  • \textsf{\large R \hspace{-.67em} epeating the character obtained \textbf{i} times.}
  • \textsf{\large Printing the r \hspace{-.67em} epeated String hence, creating the pattern.}
Attachments:
Similar questions