Computer Science, asked by kanakchamola, 1 year ago

write a program to print the following....

plzzzzz ans fast....TEST ...

Attachments:

Answers

Answered by Rudhraa
4
for(I=1;I<5;I++)
cout<<"****"<<endl;

this would do the printing

Anonymous: this is c++ language I think ...
Answered by Anonymous
4

CODE :


class print_pattern

{

public static void main(String args[])

{

for(int i=1;i<=5;i++)

{

for(int j=1;j<=4;j++)

{

System.out.print("* ");

}

System.out.println();

}

}

}


LOGIC :


➡The number of symbols in a single line is determined by the j-loop

➡The number of lines to be printed depends on i-loop.

➡This is the reason why I gave j-loop 4 times and i-loop 5 times .

➡After the j-loop , we need to go to the next line hence the statement : "System.out.println()" .

Similar questions