Computer Science, asked by LonelyHeart, 1 year ago

Hey friends! ☺

Please answer this question.

✔ Write a program in JAVA to print the given pattern:

1
11
121
1331
14641

❎ No spamming ❎

❌ No wrong answers❌

Answers

Answered by QGP
2
Hey There!


Here's the simple code for your program:


public class Pattern
{
    public static void main(String[] args)
    {
        int n=5;
       
        for(int i=0;i<n;i++)
        {
            System.out.println((int)Math.pow(11,i));
        }
    }
}




What we did was just observe the following fact:
1 = 11^0 \\ \\ 11 = 11^1 \\ \\ 121 = 11^2 \\ \\ 1331 = 11^3 \\ \\ 14641 = 11^4

Then we wrote the code for it.



Hope it helps
Purva
Brainly Community



LonelyHeart: Thank u so much sir/madam
QGP: You are welcome :)

[I am a boy, though :) ]
LonelyHeart: Sorry
QGP: No need to say Sorry. Thanks for asking.

[Others are those who assume gender themselves.] You did better :)
LonelyHeart: ^_^"
Answered by kvnmurthy19
0
public class Pattern
{
    public static void main(String[] args)
    {
        int n=5;
        
        for(int i=0;i<n;i++)
        {
            System.out.println((int)Math.pow(11,i));
        }
    }
}




What we did was just observe the following fact:
\begin{lgathered}1 = 11^0 \\ \\ 11 = 11^1 \\ \\ 121 = 11^2 \\ \\ 1331 = 11^3 \\ \\ 14641 = 11^4\end{lgathered}1=11011=111121=1121331=11314641=114​ 

Then we wrote the code for it. 
Similar questions