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]
4 years ago
12

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

Computers and Technology
1 answer:
Inessa05 [86]4 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
How can I do a project with a model on the steam machine?
user100 [1]
look up some facts about steam machines and then see when they were created and by who they were created and how they have evolved.
5 0
3 years ago
What do you understand by structured programmingapproach? Also Discuss about bottom up and top down approach.
mart [117]

Answer:

Structured programming also known as Modular programming in which the program is made as a single structure.The execution is instruction by instruction.It mainly focuses on improving the quality,clarity and development time of a computer program.

The top-down approach works by breaking a complex algorithm into smaller parts called modules. The modules keep breaking until there is no space left for breaking them without hindering the originality.The breaking of the modules is prohibited after achieving a certain level of modularity . C language uses this approach.

Bottom up works exactly opposite of how the top-down approach works.This approach works in the most elemental level of solving a problem and going up with combination of several parts of the solution to achieve required results.

4 0
3 years ago
How is sharepoint used in organization today?
tatyana61 [14]
<span>To build a team site and collaborate with your colleagues</span>
8 0
3 years ago
What symbol should you look for to determine who owns the intellectual property of a website? the logo the web address the domai
devlian [24]

Answer:

Answer:

the logo of the company or corporation

Explanation:

Usually, the symbol that determines who owns the intellectual property is the logo of the company or corporation. The logo of a website is technically the logo of the brand which has the rights to all of the information represented on the site and ultimately the intellectual property of the site itself. Since there are various board members that usually make up the company that owns the intellectual property, the logo is a way of representing all of these members as a single entity.

8 0
2 years ago
Read 2 more answers
What is an insertion point?
Tasya [4]
The answer to that would have to be c I think this is it so a feature bl bl bla
7 0
3 years ago
Other questions:
  • What are the benefits of organizing your thoughts before you begin your speech
    14·1 answer
  • what is it called when you are biying and selling products via electronic channels such as the internet​
    13·2 answers
  • You are configuring a switch that has three hosts attached to FastEthernet 0/2 through 0/4. All three hosts are part of a public
    10·1 answer
  • Choose a project with a relatively simple description (building a LAN, designing a web page, inventing a new communication devic
    6·1 answer
  • Dayla is concerned about managing her digital footprint. What does she mean by this? *
    7·1 answer
  • Where do you place the logical test argument in an JF function formula?
    5·2 answers
  • Programmers should strive to _____. increase coupling increase cohesion both of the above neither a nor b
    7·1 answer
  • I make a budget of my 1st Gamer PC its good?
    9·1 answer
  • Hey guys, I don’t have a problem for you but If anyone knows do you still pass your grade level if you failed 1 class in the las
    11·2 answers
  • The equals method of the Object class returns true only if the two objects being compared:_________
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!