1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Crazy boy [7]
3 years ago
10

How many times is the text "Let's have fun with Java." printed when this code snippet is run? int i = 0; do { System.out.println

("Let's have fun with Java."); i++; if (i % 2 == 0) { i = 10; } } while (i <= 10);
Computers and Technology
1 answer:
mash [69]3 years ago
8 0

Answer:

The above code print the text at three times.

Explanation:

  • It is because the above code has one loop which executes three times. The loop executes for the value of i = 0,1 and 10.
  • when the value of i is 0 then "++i" will increase the value 1 and the text will be printed.
  • If the value of i=1, then the value of i is 2 in the second iteration and the again the text is printed, then the if condition gives the true result and the value of i will be 10.
  • Then the loop executes for the last time when the value of i is 10.Then the value will be 11 because of the increment operator and the text will be printed for the third time.
  • Then the while loop is not true for the 11 value of i and the loop will get terminated.
You might be interested in
The advantage of an electronic ____ is that the content can be easily edited and updated to reflect changing financial condition
Lana71 [14]
Computer.................................
6 0
3 years ago
Homework 8 Matlab Write a function called fibonacciMatrix. It should have three inputs, col1, col2, and n. col1 and col2 are ver
Amiraneli [1.4K]

In this exercise we have to use the knowledge in computational language in python to write the following code:

We have the code can be found in the attached image.

So in an easier way we have that the code is:

<em>function v = myfib(n,v)</em>

<em>if nargin==1</em>

<em>    v = myfib(n-1,[0,1]);</em>

<em>elseif n>1</em>

<em>    v = myfib(n-1,[v,v(end-1)+v(end)]);</em>

<em>end</em>

<em>end</em>

<em>function v = myfib(n,v)</em>

<em>if nargin==1</em>

<em>    v = myfib(n-1,[0,1]);</em>

<em>elseif n>1</em>

<em>    v = myfib(n-1,[v,v(end-1)+v(end)]);</em>

<em>elseif n<1</em>

<em>    v = 0;</em>

<em>end</em>

<em>function [n] = abcd(x)</em>

<em>if (x == 1 || x==0)</em>

<em>    n = x; </em>

<em>    return</em>

<em>else</em>

<em>    n = abcd(x-1) + abcd(x-2);</em>

<em>end</em>

<em>end</em>

<em>fibonacci = [0 1];</em>

<em>for i = 1:n-2</em>

<em>    fibonacci = [fibonacci fibonacci(end)+fibonacci(end-1)];</em>

<em>end</em>

<em>>> myfib(8)</em>

<em>ans =</em>

<em>    0    1    1    2    3    5    8   13</em>

<em>>> myfib(10)</em>

<em>ans =</em>

<em>    0    1    1    2    3    5    8   13   21   34</em>

See more about python at  brainly.com/question/18502436

8 0
1 year ago
The action displayed in the status bar while pointing-
Mrac [35]

Answer:

c

Explanation:

6 0
3 years ago
Jamie is using the UNIX file system to work on his computer. He puts a dot before the file extension to separate it from the fil
klio [65]

Answer: as a file extension

Explanation:

4 0
3 years ago
Read 2 more answers
Why did utf 8 replace the sac character encoding standard
Sedaia [141]
UTF-8- is a variable width character encoding capable of encoding all 1,112,064 valid code points in Unicode using one to four 8-bit bytes. The encoding is defined by the Unicode standard. The sac character encoding method was addressed to simplify the symbolism of letter and symbols.As the computers grew in capacity UTF-8 method was implemented to optimize such protocol allowing more characters to be included with an expanded string of possibilities
7 0
3 years ago
Other questions:
  • What is a major plastics engineering project that is going on right now in Arizona?
    9·1 answer
  • The eastern front was longer than other fronts of the war true or false
    7·2 answers
  • ______ is the software that blocks a user from being able to access your computer.
    9·1 answer
  • A writing team wants to present the six-month sales figures for its company's 14 sales representatives in a report. Because mana
    11·1 answer
  • How does a author develop a character in a story?
    14·2 answers
  • To inspire unit 1 App
    11·1 answer
  • How many questions do you have to answer before you can use direct messages on Brainly?
    13·2 answers
  • How can you have internet without subscribing to cable?
    13·1 answer
  • The hardware and software that must be implemented to support the applications that the primary activities use are a part of the
    14·1 answer
  • In a database, what term is used to describe a group of fields that are all associated with and accessed using single primary ke
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!