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
timofeeve [1]
3 years ago
13

Write a java program to print the following series: 1 5 9 13 17...n terms​

Computers and Technology
2 answers:
andrew11 [14]3 years ago
6 0

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

int n;

System.out.print("Max of series: ");

n = input.nextInt();

for(int i = 1; i<=n;i+=4){

    System.out.print(i+" ");

}

}

}

Explanation:

This declares n as integer. n represents the maximum of the series

int n;

This prompts the user for maximum of the series

System.out.print("Max of series: ");

This gets user input for n

n = input.nextInt();

The following iteration prints from 1 to n, with an increment of 4

<em> for(int i = 1; i<=n;i+=4){</em>

<em>     System.out.print(i+" ");</em>

<em>}</em>

trapecia [35]3 years ago
4 0

Answer:

In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

int n;

System.out.print("Max of series: ");

n = input.nextInt();

for(int i = 1; i<=n;i+=4){

   System.out.print(i+" ");

}

}

}

Explanation:

This declares n as integer. n represents the maximum of the series

int n;

This prompts the user for maximum of the series

System.out.print("Max of series: ");

This gets user input for n

n = input.nextInt();

The following iteration prints from 1 to n, with an increment of 4

for(int i = 1; i<=n;i+=4){

   System.out.print(i+" ");In Java:

import java.util.*;

public class Main{

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

int n;

System.out.print("Max of series: ");

n = input.nextInt();

for(int i = 1; i<=n;i+=4){

   System.out.print(i+" ");

}

}

}

Explanation:

This declares n as integer. n represents the maximum of the series

int n;

This prompts the user for maximum of the series

System.out.print("Max of series: ");

This gets user input for n

n = input.nextInt();

The following iteration prints from 1 to n, with an increment of 4

for(int i = 1; i<=n;i+=4){

   System.out.print(i+" ");

}

Explanation:

You might be interested in
Which fund classification would a focus on only stocks of technology companies match?
Bumek [7]

Answer:

Growth funds

Explanation:

This funds fucos on capital appreciation

5 0
3 years ago
Implement the function couple, which takes in two lists and returns a list that contains lists with i-th elements of two sequenc
In-s [12.5K]

Answer:

couple.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

s1=[1,2,3]

s2=[4,5,6]

print(couple(s1,s2))

enum.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

def enumerate(s,start=0):

  number_Array=[ i for i in range(start,start+len(s))]

  return couple(number_Array,s)

s=[6,1,'a']

print(enumerate(s))

print(enumerate('five',5))

Explanation:

7 0
3 years ago
Why are my images blocked on brainly<br><br> i just see gray and on every avatar and image
o-na [289]

Answer:

they are not its just that people haven't changed their profile picture. i haven't yet lol

Explanation:

5 0
2 years ago
Read 2 more answers
An _____provider is a business that provides individuals and companies access to the internet for free
boyakko [2]

Answer:A B

access provider Business that provides individuals and companies access to the Internet free or for a fee.

Explanation:

6 0
2 years ago
Read 2 more answers
What is the purpose of a div?
taurus [48]

Answer:

I'd choose A, all of the above.

Reasoning Why:

I'll be taking you on a step to step process on why I inputted the answer.

The <div>, is basically like a container that you can group tougher, why this is great is because you can edit the div using a background-color effecting that group such as the following..

EXAMPLE OF BACKGROUND-COLOR DIV (background-color)

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample{

background-color:red;

/*Example of the Background-color attrib*/

/*You can also use the background-image attrib, however I recommend you checkout W3Schools, on that topic.*/

}

</style>

</head>

<body>

<div id="byexample">

<p>Just some random text to demonstrate.</p>

</div>

</body>

</html>

END OF EXAMPLE

You can also, in the <div> change multiple styles of an element in the div. However, if do want to change the styles of a single element you would need to nest it.

<!DOCTYPE html>

<html>

<head>

<title>Brainly Example | HTML Div</title>

<style>

#byexample #text{

background-color:red;

color:yellow;

}

</style>

</head>

<body>

<div id="byexample">

<p id="text">Just some random text to demonstrate.</p>

</div>

</body>

END OF EXAMPLE

Lastly, you can group elements using divs, as stated in openclassroom (website).

Anyways, I hope this helped!

Happy coding!

5 0
3 years ago
Other questions:
  • Please look at picture
    10·2 answers
  • Ming is building an inexpensive computer to use for her online classes, and needs to purchase Windows. What is the most cost-eff
    8·1 answer
  • Please help me with these questions
    5·1 answer
  • Explain one thing you will start doing as a passenger.
    10·2 answers
  • Choose two browsers and compare their security features.
    5·1 answer
  • What is the function of the NOS? Select all that apply.
    5·2 answers
  • Vadik is creating a program where the user inputs their grade level and the program tells them which sports teams they are allow
    9·2 answers
  • Sustainable development is a goal towards which all human societies need to be moving. elaborate the statement in about 120 word
    9·1 answer
  • (Just wondering and for fun) What can humanity do to survive after the universe dies? Assuming we have advanced tech and there a
    9·1 answer
  • Which two features offered by SharePoint
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!