➻Write a (java) program to print the square of first 10 numbers.
No spam ✘
Answers
Answered by
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
5
Answer:
here is your answer hope this is helpful from you
Attachments:
Similar questions
Science,
1 month ago
Social Sciences,
1 month ago
Math,
1 month ago
Biology,
3 months ago
Computer Science,
3 months ago
Science,
10 months ago
Art,
10 months ago
Math,
10 months ago