0
How to write this one in C#?
Anna's hummingbird, now believed to be the fastest bird in the world relative to its size, can reach speeds of 80 km per hour. Task: Write a program to output how many kilometers it will travel each hour over 5 hours of flight. Output 80 160 240 320 400 Hint: Simply multiply 80 by a counter for each iteration. Use the for loop to perform the multiplications iteratively.
2 Answers
+ 5
Mihir Chakma
I think Hint is already given.
0
{
int x = 80; // Speed in kilometers per hour
int y = 0;
for (int hour = 1; hour <= 5; hour++)
{
y += x;
Console.WriteLine("{0}", y);
}
}