write a java program to print the sum of the following series:S=99+80+63+......upto 10 terms.
Answers
Answer:
int a=9,b=11,s=0;
for (i=1,i<=10,i++)
{
s=s+a*b;
a--;
b--;
}
Sopln(s);
Following are the program for the above question.
Explanation:
Program :
public class Series //class definition for series.
{
public static void main(String[] args) //main function.
{
int first_increament=9,second_increment=11,Total=0; //variable declaration.
System.out.print("The sum of the series "); //print the message.
for (int i=1;i<=10;i++) //for loop for the series.
{
Total=Total+(first_increament*second_increment); //operation for series.
System.out.print(first_increament*second_increment+",");//print the series.
first_increament--;
second_increment--;
}
System.out.print("are "+Total); //print the sum of the series.
}
}
Output:
- The above codes provide the series with the sum.
Code Explanation:
- The above code is in java language, in which the total variable is used to add the series of the value and then it render the output by the System.out.print function.
Learn More:
- Java program : https://brainly.in/question/8262360