0

I am a student. I have written the following program for an assignment. The assignment is to seconds into Hours, minutes and seconds. However, I think I have done the program right, but I keep getting the following two errors: ComputeMinutesAndSeconds (int): not all code code paths have a return and on ComputeHoursMinutesAndSeconds(int): not all code paths have a return.

If someone would be willing to offer me a little advice I would appreciate it.

```
using System;
/*This program is designed to find the amount of hours, minutes and seconds, that are in the number of seconds givenh by the user*/
public class Lab4
{
public static void Main()
{
int number,
result1,
result2;
InputMethod(out number);
result1 = ComputeMinutesAndSeconds(number);
result2 = ComputeHoursMinutesAndSeconds(number);
}
public static void InputMethod(out int number)
{
string n1;
Console.WriteLine("Enter any number of seconds and this program will covert your number of seconds to: hours, minutes and seconds");
n1 = Console.ReadLine();
number = Convert.ToInt32(n1);
}
public static int ComputeMinutesAndSeconds(int num)
{
int sec = 1;
int minutes = sec * 60;
int ans_Min = 0;
int ans_Sec = 0;
while (num < 3600)
{
ans_Min = num/minutes;
ans_Sec = ((ans_Min * minutes) - num) * sec;
Console.WriteLine("There are {0} minutes and {1} seconds in {2} seconds",ans_Min, ans_Sec, num);
if (num > 3600)
{
return num;
break;
}
}
}
public static int ComputeHoursMinutesAndSeconds(int num)
{
int sec = 1;
int hours = sec * 3600;
int minutes = sec * 60;
int ans_Hour = 0;
int ans_Min = 0;
int ans_Sec = 0;
int numberX = 0;
while (num >= 3600)
{
ans_Hour = num/hours;
numberX = ((ans_Hour * hours)- num);
ans_Min = numberX/minutes;
Console.WriteLine("There are {0} hours, {1} minutes, and {2} seconds in {3} seconds", ans_Hour, ans_Min, ans_Sec, num);
ans_Sec = ((ans_Min * minutes)- numberX)* sec;
if (num < 3600)
{
return num;
break;
}
}
}
}
```

*Edited
by mike_2000_17*: Fixed formatting