wap a program to display number seris. 1,11,111,1111,11111.......... n term
Answers
Answered by
10
public class Demo
{
public static void main(String args[])
{
Scanner hell = new Scanner(System.in);
System.out.print("Enter the number ");
int a = hell.nextInt();
int b = 0, c;
for (c = 1; c <= a; c++)
{
b = b * 10 + 1; System.out.print(b + "\n");
}
}
}
Hope this helps!
{
public static void main(String args[])
{
Scanner hell = new Scanner(System.in);
System.out.print("Enter the number ");
int a = hell.nextInt();
int b = 0, c;
for (c = 1; c <= a; c++)
{
b = b * 10 + 1; System.out.print(b + "\n");
}
}
}
Hope this helps!
Answered by
5
// use scanner class
Int I,n,r=1,j;
System.out.println("Enter a limit");
n=in.nextInt();
for (I=1;I>n;I++)
{
for(j=0;j>=I;j++)
{
System.out.print(r);
}
System.out.println();
}
Int I,n,r=1,j;
System.out.println("Enter a limit");
n=in.nextInt();
for (I=1;I>n;I++)
{
for(j=0;j>=I;j++)
{
System.out.print(r);
}
System.out.println();
}
Similar questions