Java Loops II

  • + 4 comments
    hi guys below is my code i'm not getting the output please correct me
    

    public static void main(String []argh){ Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();
        int n = in.nextInt();
         int size=n-1;
        int su=a;
    
        if(a>=0 && b>=0 && n>0){
            for(int i=0;i<=size;i++){
                 int power= (int)Math.pow(2,i);
                 su=su+power*b;
                 System.out.format("%d ",su);
            }
            System.out.println();
    
        }
        in.close();
    }