public static void main(String[] args)
{
Count(6);
}
public static int Count(int x)
{
int sum = 0;
for (int i = 1; i <= x; i++)
{
if (i == x)
{
System.out.print(i + "^" + i + " = ");
}
else
{
System.out.print(i + "^" + i + " + ");
}
sum += Math.pow(i,i);
}
System.out.println(sum);
return sum;
}