Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

java program help!! ok so i have to "write a for loop indexed by the int variable k to print out the sum of the function k^k for k starting at 1 and ending with N, where N is an integer command-line, input. In other words the sum; " sum = 1^1 + 2^2 + 3^3 + 4^4 +5^5 +.....+(N-1)^(N-1) + N^N i hope this makes sense.....but i just need to output the sum for the given input... i was trying to do it but it doesn't work

OpenStudy (anonymous):

public static void main (String args[]) { double Pow,Sum; System.out.println("Enter a number"); int UserIn =in.readln; for(int i=1;i<=UserIn ; i++) Pow=i*i; Sum=+Pow System.out.print("Sum= " + Sum + "+" ); } sorry I didnt test it but I think it will do the job

OpenStudy (anonymous):

hey thanks I actually just got the program to work after I posted the question, but thank anyways! :).

OpenStudy (anonymous):

you welcome @mxn5051

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!