Write a program to print a pattern by using 2 loop in Java language
13579
35791
57913
79135
91357
Answers
Answered by
3
ANSWER
..........
import java.io.*;
class LL
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Number Limit ");
int n=Integer.parseInt(br.readLine());
int k=2;
int l=3;
System.out.print("1"+" "+"3"+" ");
for(int i=1;i<=n;i++)
{
k+=Math.pow(2,i-1);
l+
System.out.print(l+" ");
}
}
}
..........
import java.io.*;
class LL
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Number Limit ");
int n=Integer.parseInt(br.readLine());
int k=2;
int l=3;
System.out.print("1"+" "+"3"+" ");
for(int i=1;i<=n;i++)
{
k+=Math.pow(2,i-1);
l+
System.out.print(l+" ");
}
}
}
ShubhamKumar1357:
Thanks
Similar questions