Computer Science, asked by Anonymous, 16 days ago

➻Write a (java) program to print the square of first 10 numbers.

No spam ✘​

Answers

Answered by Anonymous
6

Answer:

refer the pic siso and one more answer

// Java Program to find sum of

// square of first n natural numbers

import java.io.*;

class GFG {

// Return the sum of square of first n natural numbers

static int squaresum(int n)

{

// Iterate i from 1 and n

// finding square of i and add to sum.

int sum = 0;

for (int i = 1; i <= n; i++)

sum += (i * i);

return sum;

}

// Driven Program

public static void main(String args[]) throws IOException

{

int n = 4;

System.out.println(squaresum(n));

}

}

hope it helps

plz mark as brainliest if you are satisfied with the answer

have a great day

keep smiling always dear sis..

Attachments:
Answered by pnihasika28
5

Answer:

here is your answer hope this is helpful from you

Attachments:
Similar questions