Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Factorial;
- import java.util.Scanner;
- public class series {
- public static void main(String[] args) {
- Scanner ss= new Scanner(System.in);
- int n=ss.nextInt();
- int sum=0;
- for (int i = 1; i <= n; i+=2) {
- sum+=i*i;
- }
- System.out.println("sum is = "+sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement