Computer Science, asked by kittykatmeow, 3 months ago

write a program in java to display the first ten terms of the series: 4 16 36 64


kittykatmeow: pls answer asap!

Answers

Answered by himanshu2006vps
1

import java.io.*;

public class Series

{

public static void main(String args[])

{

for (int i = 2; i<20 ; i+=2 )

{

int a=i*i;

System.out.print(a+",");

}

}

}

Answered by atrs7391
0

Answer:

package com.company;

public class Main {

   public static void main(String[] args)

   {

       int n = 10;

       int n1 = n*2;

       int s;

       int s1 = 0;

       System.out.print("The series: ");

       for (int i = 2; i<=n1 ; i+=2 )

       {

           s = i*i;

           System.out.print(s+"  ");

           s1 = s1+s;

       }

       System.out.println(" ");

       System.out.println("The Sum of the Series: "+s1);

   }

}

Similar questions