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
The chart shows an example of a study-time survey. Students can use the formula shown in the survey to figure out ways to track
LUCKY_DIMON [66]
<span>how many hours they can work on a project.</span>
3 0
3 years ago
Which headphones are a better option, the HyperX Cloud Stinger or the Logitech G432
seropon [69]

Answer:

The Logitech ones.

Explanation:

Surprisingly I've used all 3 of them and the Logitech ones are the one with not only the best sound quality. And the mic isn't horrible either.

6 0
2 years ago
Describe two ways methods that cab be used to help stop hacking
mojhsa [17]

Answer:

Use a firewall

Install antivirus software.

Explanation:

7 0
2 years ago
Part 3 (The stunner)
Drupady [299]

Answer:

nice :)

Explanation:

7 0
2 years ago
Read 2 more answers
Which of the following is NOT a semantic reason for using header tags
Olegator [25]

Answer:

The correct option is;

C. They make text larger and bold

Explanation:

The semantic reasons for using header tags which are the benefits users derive from including header tags in content published on the web includes;

1) They give structure to the writing included in the document

2) Header tabs allow text to be broken into sections with different content in focus

3) Header tags are used to add key words to a page

4) To boost search engine optimization SEO

5) To improve visibility.

4 0
3 years ago
Other questions:
  • Your bank offers to lend you $114,400 at an 8.5% annual interest rate to start your new business. The terms require you to amort
    11·1 answer
  • Which activity does not allow a person to perform any work while at the shop
    10·1 answer
  • A security utility program that scans the system for small programs that interfere with how a computer functions are _____ utili
    13·1 answer
  • A browser is used for creating Web pages. true or false?
    5·2 answers
  • What is metrical task system algorithm?? and can we use that in online shopping project??
    11·1 answer
  • Describe advantages and disadvantages for microprocessor controlled devices in the household.
    7·1 answer
  • I'm showing my friends brainly. Answer with anything so they can see how fast I can get answers.
    10·2 answers
  • Write an application named Hurricane that outputs a hurricane’s category based on the user’s input of the wind speed. Category 5
    7·1 answer
  • How to get the lightning round in dares of eternity
    5·1 answer
  • Class Main {
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!