We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Java
  3. Introduction
  4. Java Loops II
  5. Discussions

Java Loops II

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • RangelMX 2 years ago+ 0 comments
                int a = in.nextInt();
                int b = in.nextInt();
                int n = in.nextInt();
    						
                for (int j=0; j<n ; j++){ 
                    for (int k=0; k<=j; k++)
                        acum = (int) (acum + Math.pow(2, k)*b);	
                    System.out.print(a+acum+" "); 
                    acum=0;
                }
                System.out.println();
    
    3|
    Permalink
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature