Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class ExerciseTwo
- {
- public static void main (String[] args)
- {
- printPowersof2(3);
- }
- public static void printPowersof2(int max)
- {
- for (int i =0; i<=max; i++) //exponent
- {
- double ans=Math.pow(2,i);
- System.out.print(ans);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement