please solve this pattern in java...
Attachments:
Answers
Answered by
2
Answer:
import java.util.*;
class pascals_triange
{
public static void main()
{
Scanner sc = new Scanner (System.in);
int n,i,j,l,m,p;
System.out.print("Enter the number of rows: ");
n=sc.nextInt();
for(i=1;i<=n;i++)
{
p=i-1;
for(l=1;l<=n-i;l++)
{
System.out.print(" ");
}
for(j=1;j<=i;j++)
{
System.out.print("*");
}
for(m=1;m<=i-1;m++)
{
System.out.print("*");
}
System.out.println();
}
}
}
Answered by
2
Go through the pic and compile your program in bluej or any other platform of java,I have made without using Scanner.
Attachments:
Similar questions
Math,
5 months ago
Social Sciences,
5 months ago
Social Sciences,
11 months ago
Math,
11 months ago
Political Science,
1 year ago
Math,
1 year ago