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
Swapping two numbers
Tju [1.3M]

Answer:

Swapping two numbers means exchange the values of two variables with each other.

8 0
3 years ago
Pls help help me is good help me helping is very good
skelet666 [1.2K]

Answer:

-56 negative

Explanation:

8 0
2 years ago
What output is produced by the following code? Integer first = new Integer(7); Integer second = first; if (first == second) Syst
fenix001 [56]

Answer:

The correct output of this question is  "Sneezy Sleepy".

Explanation:

In the given code firstly we create the object of the integer class that is first in this we pass the integer value that is 7. Then we declare another second integer variable is this variable we pass object as a reference. Then we use the two conditional statements. In the first, if block we check that the object of the class is equal to the reference variable. If it is true it prints Sneezy. otherwise, it will print Grumpy. In second if block we check that the object of the class is equal to the reference variable. but in this time we the equals() function it is the same as(==). If the condition is true it prints Sleepy. otherwise, it will print Doc. So the output of the code is Sneezy Sleepy.

6 0
2 years ago
What is a data source in OLE?​
babunello [35]

Answer:

OLE DB Driver for SQL Server uses the term data source for the set of OLE DB interfaces used to establish a link to a data store, such as SQL Server. Creating an instance of the data source object of the provider is the first task of an OLE DB Driver for SQL Server consumer.

Explanation:

hope it helps you and give me a brainliest

6 0
1 year ago
How does human error relate to security risks
oksian1 [2.3K]

Answer:

The error could let people through who really shouldn't be through

8 0
2 years ago
Other questions:
  • Please look at picture
    10·2 answers
  • In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the
    12·1 answer
  • Lesson 15: Integrated Literacy Connections Education Introduction to Computer Applications Unit 6: Internet Safety
    5·1 answer
  • How would Microsoft Word inform you of the error in the sentence below? (Tip: The error is in bold.)
    7·1 answer
  • In which of the security mechanism does the file containing data of the users/user groups have inbuilt security?
    6·1 answer
  • The __________ assumption necessary for a linear programming model to be appropriate means that the contribution to the objectiv
    6·1 answer
  • The Windows Remote Desktop Web connection that allows users to connect to a work or home computer and access files is considered
    7·2 answers
  • A group of users is unable to connect to the network. When testing several of the PCs and issuing the command ipconfig, the tech
    10·1 answer
  • How does digital and hybrid computers differ in portability​
    9·1 answer
  • How does accenture generate value for clients through agile and devops?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!