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
FinnZ [79.3K]
3 years ago
5

Program to calculate series 10+9+8+...+n" in java with output

Computers and Technology
1 answer:
avanturin [10]3 years ago
5 0

Answer:

import java.util.Scanner;

class Main {

 public static int calcSeries(int n) {

   int sum = 0;

   for(int i=10; i>=n; i--) {

     sum += i;

   }

   return sum;

 }

 public static void main(String[] args) {

   Scanner reader = new Scanner(System.in);

   int n = 0;

   do {

     System.out.print("Enter n: ");

     n = reader.nextInt();

     if (n >= 10) {

       System.out.println("Please enter a value lower than 10.");

     }

   } while (n >= 10);

   reader.close();

   System.out.printf("sum: %d\n", calcSeries(n));

 }

}

You might be interested in
Cathy designed a website for a cereal brand. When users view the website, their eyes first fall on the brand name, then they vie
PSYCHO15rus [73]

Answer:

dominance

Explanation:

i just took it and got it right

4 0
3 years ago
Select the phrases that apply to Java classes or methods.
oee [108]

Answer:

graficar una lista de entradas

graficar una lista de entradas

crear un nuevo objeto

condiciones de prueba

romper un ciclo

romper un ciclo

Explanation:

7 0
2 years ago
public class N extends String, Integer { } When you compile, you get the following message: N.java:1: ‘{‘ expected public class
GREYUIT [131]

Correct Question:

Public class N extends String, Integer { } When you compile, you get the following message: N.java:1: ‘{‘ expected public class N extends String, Integer ^ 1 error Explain what the problem is and how to fix it.

Note the capital letter P

Answer and Explanation:

Problem: This is a syntax error, the key word "public" should begin with a small letter and not capital letter.

How to fix: Replace the capital letter P by  small letter p and recompile.

8 0
3 years ago
What is computer engineering in your own words?
nordsb [41]

Answer: Computer engineering refers to the study that integrates digital engineering with computer sciences to design and develop computer structures and different technological gadgets.

Explanation:

5 0
3 years ago
Fix the regular expression used in the rearrange_name function so that it can match middle names, middle initials, as well as do
marysya [2.9K]

Answer:

name = re.search(r"^([\w \.-]), ([\w \.-])$", list_name)

Explanation:

Regular expression is used to simplify the mode in which items in a data structure are for. It uses wildcards as shortcuts.

The python module for regular expression is 're'. The import statement is used to get the module and the search() method of the module is used to get the one matching item while the findall() method is used to get a list of all the matching items in a data structure.

7 0
2 years ago
Other questions:
  • ______ includes websites that encourage interaction and connection among people, businesses, and organizations.
    9·2 answers
  • What is the difference between C and C++. If I know C, will it be hard to lean C++?
    15·1 answer
  • Two of the people most often credited with the invention of the Internet and WWW respectively are _____.
    14·1 answer
  • 4.17 LAB: Varied amount of input data ( C++)
    5·1 answer
  • Escribe un ejemplo de:• Software de aplicación. • Software de diagnóstico. • Software de sistema. ayudenme plis, me toca entrega
    10·1 answer
  • Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the
    8·1 answer
  • Practising some questions for board exams for class 12 python,pls help with detailed answer
    14·1 answer
  • A(n) ________ address is the address that external entities use when communicating with your network.
    11·1 answer
  • Define management styles
    14·2 answers
  • Which image file format is an uncompressed raster file which may contain different depths of color depths per pixel, or may be s
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!