1.
Time converter
[Link]("Enter total seconds: ");
int totalseconds = [Link]([Link]());
//convert seconds into hours
int hours = totalseconds / 3600;
//convert seconds into minutes by using %:modulus operator we also want to
convert remaining seconds.
int minutes = (totalseconds % 3600) / 60;
//find remaining seconds
int seconds = totalseconds % 60;
//print
[Link]($"{[Link]("D2")}:{[Link]("D2")}:
{[Link]("D2")}");
[Link]("\nPress any key to exit...");
[Link]();
2. Extract Digits
Extract thousands, hundreds, tens, and units from a number.
[Link]("Enter a 4-digit number: ");
int num = [Link]([Link]());
int thousands = num / 1000;
int hundreds = (num / 100) % 10;
int tens = (num / 10) % 10;
int units = num % 10;
[Link]($"Thousands: {thousands}");
[Link]($"Hundreds: {hundreds}");
[Link]($"Tens: {tens}");
[Link]($"Units: {units}");
[Link]("\nPress any key to exit...");
[Link]();
3. Convert Days → Years, Weeks, Days
[Link]("Enter total days: ");
int days = [Link]([Link]());
int years = days / 365;
int remainingDays = days % 365;
int weeks = remainingDays / 7;
int finalDays = remainingDays % 7;
[Link]($"{years} years, {weeks} weeks, {finalDays} days");
4. 4-bit Binary to Decimal
[Link]("Enter 4-bit binary: ");
int binary = [Link]([Link]());
int d1 = binary / 1000;
int d2 = (binary / 100) % 10;
int d3 = (binary / 10) % 10;
int d4 = binary % 10;
int result = d1 * 8 + d2 * 4 + d3 * 2 + d4;
[Link]("Decimal: " + result);