Write a program in Java to print the sum.
Answers
Answered by
0
this is the answe for given question
Attachments:
Answered by
0
Answer:
public class Main
{
public static void main(String[] args)
{
int s=0;
for(int n=1;n<=10;n++)
s=(n%2==0)?s+n:s+n*n;
System.out.println(s);
}
}
Similar questions