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
Maslowich
3 years ago
7

Create a program asks a user for an odd positive integer. If the user gives and even number or a number that is negative it prom

pts the user to enter a number again. Once the user enters a number it sums all the odd numbers between 1 and the number entered.
Computers and Technology
1 answer:
KiRa [710]3 years ago
6 0

Answer & Explanation:

//written in java

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {

       // variable for number imput and for the output to

       //to be calculated

       int number, output = 0;

       //a do while loop to first ask for user input

       //and check if its a odd number and a positive integer

       do {

           System.out.println("Please enter a positive odd integer");

           //scanner class to accept user input

           Scanner input = new Scanner(System.in);

           number = input.nextInt();

           //the next line make sure input is a

           // positive integer and also odd

           //number

       } while (number % 2 == 0 || number < 1);

       //for to sum all value of odd numbers between

       //1 and the inputted value

       for (int i = 3; i < number; i = i + 2) {

           output = output + i;

       }

       //print out output

       System.out.println("sums of all the odd numbers between 1 and the " + number + " is " + output);

   }

}

...............................................................................................................................................

Sample of the program output

> Please enter a positive odd integer

< 12

> Please enter a positive odd integer

< 13

> sums of all the odd numbers between 1 and the 13 is 35

You might be interested in
The _ are the devices that allow a computer system to communicate and interact with the outside world as well as store informati
padilas [110]

Answer:

I think the answer is the central processing unit. Hope it helps!!!!!

5 0
4 years ago
5. How should you use LinkedIn Answers as a professional?
harkovskaia [24]

The LinkedIn Answers is a component of LinkedIn that allows you to get fast and accurate solutions to your questions. It provides a forum through which you can demonstrate your expertise by offering info to your network. You should use LinkedIn answers to ask and answer questions. Essentially, you should use it to provide examples to your work product, decision making skills, and on an interactive basis.






5 0
3 years ago
All of the language commands that the CPU understand make up the CPU's
disa [49]
I think assembly level command mov ,push ,call
5 0
3 years ago
____________ refers to the computer-to-computer transmission of business data in a structured format.
motikmotik

Answer:

Electronic Data Interchange (EDI)

Explanation:

Electronic Data Interchange

It is the automated interchange of commercial information using a structured format. A process that allows a company to send information to another company electronically rather than on paper. Commercial entities that conduct business electronically are called business partners.

Numerous commercial documents can be exchanged using electronic data interchange, but the two most common are purchase orders and invoices. At a bottom, EDI interchanges the preparation and handling of mail associated with traditional commercial communication. However, the true power of EDI is that it standardizes the information communicated in commercial documents, which makes a "paperless" exchange possible.

6 0
3 years ago
(tco 8) when a file is opened in the append mode, the file pointer is positioned
Artyom0805 [142]
At the end of the file, so that additional data is appended while the existing data stays intact.
6 0
4 years ago
Other questions:
  • Which statement best describes antivirus software
    12·2 answers
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • In addition to the four primary computer operations, today's computers almost always perform ____ functions.
    7·1 answer
  • What is the voltage drop across R4 in the diagram shown above?
    13·1 answer
  • 1. compression
    11·1 answer
  • 2 (01.01 LC)
    5·1 answer
  • Write a method printshampoolnstructions0, with int parameter numCycles, and void return type. If numCycles is less than 1, print
    8·1 answer
  • Select the four bad password ideas.
    13·2 answers
  • Drag each tile to the correct box.
    15·2 answers
  • _____ oversee the work of various types of computer professionals and must be able to communicate with people in technical and n
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!