Create a new project, and name it P1T4
Write a program that requests a number of minutes from the user and then converts and displays the minutes as hours and minutes
Hint – make use of the / and % operators
Your running program could resemble the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace P1T4
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter a number of minutes: ");
int minutes = Convert.ToInt32(Console.ReadLine());
int hours = minutes / 60;
minutes = minutes - hours * 60;
Console.WriteLine(" {0:00} : {1:00}", hours, minutes);
Console.ReadKey();
}
}
}
Comments
Leave a comment