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.

5th Aug 2022, 4:19 PM
Mihir Chakma
2 Answers
+ 5
Mihir Chakma I think Hint is already given.
5th Aug 2022, 4:49 PM
AĶ¢J
AĶ¢J - avatar
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); } }
16th Jan 2024, 5:49 PM
Armando Robles
Armando Robles - avatar