Showing posts with label Minutes and Seconds in C#. Show all posts
Showing posts with label Minutes and Seconds in C#. Show all posts

Saturday, October 15, 2016

Seconds To Hours, Minutes and Seconds in C#

A very simple program that I wrote using C# as my programming language that will ask the user to give time in seconds and then our program will converted the given time in hours, minutes and seconds.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace time_conversion
{
    class time_check
    {
        static void Main(string[] args)
        {
            long v,sec,hr,min; 

            Console.Write("Time Converter Converter");
            Console.Write("\n\n");
            Console.Write("Enter Time in Seconds   : ");
            sec = Convert.ToInt32(Console.ReadLine());

            hr=sec/3600; 
            v=sec%3600; 
            min=v/60; 
            sec=v%60; 

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine(" Time in hour:min:sec is: {0}:{1}:{2}." ,hr,min,sec);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}