-
Hello, java help :D
Hello is me chicken again guys. Some of you know me from 2016/15-2018, I wanted to ask help to do this assignment as I am not a coder... This is supposed to be in java, thank you, chicken is very grateful.
Here below:
Write a void method printPowers which uses a while loop to print the the first three powers of 1 - 5 as shown below.
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
-
heres the code in C#
Code:
public void printPowers()
{
double i=1.0;
while (i<6)
{
Console.Write(Math.Pow(i, 1.0)+" ");
Console.Write(Math.Pow(i, 2.0)+" ");
Console.Write(Math.Pow(i, 3.0));
Console.WriteLine();
i++;
}
-
Quote:
Originally Posted by
Bunny
heres the code in C#
Code:
public void printPowers()
{
double i=1.0;
while (i<6)
{
Console.Write(Math.Pow(i, 1.0)+" ");
Console.Write(Math.Pow(i, 2.0)+" ");
Console.Write(Math.Pow(i, 3.0));
Console.WriteLine();
i++;
}
Thanks bunny. As always you're a great help to me, lov u bro. Keep hustling