How write a program to prompt the user to to enter to enter time in seconds. The program then displays it in minutes and seconds | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How write a program to prompt the user to to enter to enter time in seconds. The program then displays it in minutes and seconds

//what I have done so far int seconds, minutes; Console.Write("Seconds: "); seconds = int.Parse(Console.ReadLine()); minutes = seconds / 60; seconds = seconds % 60; Console.ReadLine();

27th Oct 2017, 8:48 PM
Peter Coker
Peter Coker - avatar
5 Answers
+ 3
To add to @Sneeze suggestion, you can try this: Console.WriteLine("Time: {0:0#}:{1:0#}",minutes,seconds); Hth, cmiiw
27th Oct 2017, 9:56 PM
Ipang
+ 1
You have the data, you want to show. use Console.WriteLine to display the data. use a placeholder to use the variables in the write statement. Console.Writeline (the value is {0} , x); {0} is the placeholder x is the variable https://www.dotnetperls.com/console
27th Oct 2017, 9:26 PM
sneeze
sneeze - avatar
0
Looks good. What is your question ? Where do you get stuck ?
27th Oct 2017, 9:16 PM
sneeze
sneeze - avatar
0
The question is " How write a program to prompt the user to to enter to enter time in seconds. The program then displays it in minutes and seconds" I just need help displaying how to calculate the answer input by the user say example if a inputs 250seconds. I need help display the output as 01:10
27th Oct 2017, 9:20 PM
Peter Coker
Peter Coker - avatar
0
it worked, thanks way better than stack flow
27th Oct 2017, 10:08 PM
Peter Coker
Peter Coker - avatar