WAP in java using scanner to print pattern...................................................
Attachments:
Answers
Answered by
2
import java.util.Scanner; public class MainClass { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //Taking rows value from the user System.out.println("How many rows you want in this pattern?"); int rows = sc.nextInt(); System.out.println("Here is your pattern....!!!"); //Printing upper half of the pattern for (int i = 1; i <= rows; i++) { for (int j = 1; j <= i; j++) { System.out.print(j+" "); } System.out.println();
tamoghnadbpc:
u hv to use the values of A,B,C,D,E to generate the pattern
Answered by
7
{
int n= sc.nextInt();
{
for(int i=n ; i>=0; i--)
{
for(int j = 0; j<=i; j++)
{
}
}
}
}
The required pattern:
ABCDE
ABCD
ABC
AB
A
_____________________________
________________________
●println():- For printing the sentence from next line
●print():- To continue the sentence in the same line
Similar questions