Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class DevisibleByThree{
- public static void main (String[] args){
- Scanner sc =new Scanner(System.in);
- int num =Integer.parseInt(sc.nextLine());
- int sum=0;
- for(int i =0;i<=num*2;i++){
- if(i % 2 !=0){
- sum =sum +i;
- System.out.println(i);
- }
- }
- System.out.println("Sum: " +sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement