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
Define Agricultural Era
Evgesh-ka [11]

Answer:

This might not help, But still will let you know more!

Explanation:

The Agricultural Revolution was a period of technological improvement and increased crop productivity that occurred during the 18th and early 19th centuries in Europe. In this lesson, learn the timeline, causes, effects and major inventions that spurred this shift in production.

3 0
2 years ago
Read 2 more answers
In order to achieve a win-win solution, all parties involved should negotiate a solution. True or False ?
ryzh [129]
True you cant win if you dont know what you got right

6 0
3 years ago
Read 2 more answers
Jason works as an accountant in a department store. He needs to keep a daily record of all the invoices issued by the store. Whi
kotykmax [81]

Are there any options

3 0
3 years ago
Read 2 more answers
Samantha has to create a video for her science project on the blossoming of a flower from a bud to one with fully opened petals.
Hitman42 [59]
Samantha would have to use the ‘time-lapse’ technique to film the video in the most efficient way.
5 0
3 years ago
Read 2 more answers
Explain the following terms as used in word processin
meriva

Answer:

A drop cap (dropped capital) is a large capital letter used as a decorative element at the beginning of a paragraph or section. The size of a drop cap is usually two or more lines.

a superscript is a character(s) half the height of a standard character and printed higher than the rest of the text.

In word processing, the word indent is used to describe the distance, or number of blank spaces used to separate a paragraph from the left or right margins.

6 0
2 years ago
Other questions:
  • A Color class has a method getColorName that returns a string corresponding to the common name for the color, e.g., yellow, blue
    11·1 answer
  • What can a folder on a computer contain?
    13·2 answers
  • Being able to express your thoughts in an email is a primary technology skill. True or False
    8·2 answers
  • How do you change your age on here? I accidentally put that i was 15 but i am only 13. How do I change this?
    12·1 answer
  • Which of the following is true of how the Internet has responded to the increasing number of devices now using the network?
    7·1 answer
  • #Write a function called alter_list. alter_list should have#two parameters: a list of strings and a list of integers.##The list
    11·1 answer
  • Which question about whale sharks is nonscientific?
    11·2 answers
  • Processor is used to process the data.<br>A)true <br>B)False​
    13·1 answer
  • Different search engines available on the internet​
    7·1 answer
  • Kinda strange, and im good
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!