Deret Angka 2,0,1,3,2,9,4,3,64,5,5,625

Disini di tulis untuk menulis deret angka 2,0,1,3,2,9,4,3,64,5,5,625


public class Main {

    public static void main(String[] args) {

        int c = 1;
        for (int i = 0; i <= 5; i++) {
            if (i == 1) {
                i = i + 1;
            }
            System.out.print("" + (c = c + 1) + ",");
            System.out.print(i + ",");
            int d = (int) Math.pow(c, i);
            System.out.println(d + ",");
        }
    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s