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
stellarik [79]
3 years ago
12

WRITE A JAVA PROGRAM TO PRINT THE PATTERN 13579 2468 357 46 5

Computers and Technology
1 answer:
Inessa05 [86]3 years ago
4 0

Answer:

import java.util.Scanner;

import java.lang.*;

class Main

{

  public static void main(String args[])

  {

     int n;

     //For capturing the value of n

     Scanner scanner = new Scanner(System.in);

     System.out.println("Enter the value of n:");

     //The entered value is stored in the var n

     n = scanner.nextInt();

     int k=1;

     printnum(n,k);  

  }

  public static void printnum(int n,int k)

  {

       if(n%2==0)

       {

       for(int i=k;i<=n-1;i=i+2)

            {

                System.out.print(i);

            }    

        System.out.println("");

       }

       else

        {

       for(int i=k;i<=n-1;i=i+2)

            {

                System.out.print(i);

            }    

        System.out.println("");

        }

      n--;

      if(n<=1)

      {

         System.exit(0);

      }

      else

      {

          printnum(n,k+1);

      }

   }

}

Explanation:

The program is self explanatory.

You might be interested in
What is the Windows command to see the IP configuration of the PC?
lisov135 [29]
The answer is ipconfig
4 0
3 years ago
Which task can be completed with the Template Organizer?
spin [16.1K]

Answer:

B is the answer

Explanation:

i just got it right

8 0
3 years ago
Read 2 more answers
Silvia fue a una revisión odontológica porque tiene problemas de salud en la dentadura y sus cepillos sólo duran dos semanas. Ah
Neko [114]

Answer: ella puede usar un cepillo de dientes eléctrico

8 0
3 years ago
A store sells rope only in whole-foot increments. Given three lengths of rope, in feet, the following code segment is intended t
Lynna [10]

Answer:

The answer is "option B".

Explanation:

In the given code, four double variable "len1, len2, len3, and total" is declared, in which the first three variables accept some value, and in the total variable, we add those variable. In the next step, an integer variable minLength is defined, which converts the decimal value to an integer and adds the value that is "0.5". In this section, the code uses as an intended purpose but only if the total of 3 lengths is equivalent to or larger then 0.5, and wrong choices can be described as follows:

  • In option A, It accepts the negative value, that's why it is wrong.
  • Option C, Option D, and Option E all were wrong because the code segment is work as intended.
5 0
3 years ago
can Results shown at the top of the Google search engine results page (SERP) always get high Needs Met ratings
kondaur [170]
I think it can't.

The one that get high needs met rating are the pages that satisfy the user's search. The search engine result page that shown at the top of the result doesn't necessarily fulfil this criteria

hope this helps
7 0
3 years ago
Other questions:
  • Your computer has two basic types of software: system software and ________ software.
    9·1 answer
  • Categories of general purpose application software and examples each​
    13·1 answer
  • In a video, a motionless image is called
    7·2 answers
  • Is spread spectrum transmission done for security reasons in commercial WLANs?
    13·1 answer
  • 4. Where do you find the command to create bibliography citations or a table of contents?
    14·2 answers
  • Write a program roman which converts numbers from decimal notation into Roman numerals. roman takes a single argument, a string
    10·1 answer
  • Use the variables k and total to write a while loop that computes the sum of the squares of the first 50 counting numbers, and a
    6·1 answer
  • You looked at the methods used to determine database requirements. Now, research and find a database requirements template. Choo
    9·1 answer
  • Explain any two types of board band connection​
    11·1 answer
  • Criminal investigations are limited to finding data defined in the search ____.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!