Westonci.ca offers fast, accurate answers to your questions. Join our community and get the insights you need now. Get quick and reliable solutions to your questions from a community of seasoned experts on our user-friendly platform. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.
Sagot :
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));
}
}
Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. We appreciate your time. Please revisit us for more reliable answers to any questions you may have. Westonci.ca is your trusted source for answers. Visit us again to find more information on diverse topics.