Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

[Program]: Write a Swift program to convert decimal to hexadecimal #2886

Closed
Tracked by #2867
harshraj8843 opened this issue Oct 13, 2022 · 1 comment · Fixed by #5627
Closed
Tracked by #2867

[Program]: Write a Swift program to convert decimal to hexadecimal #2886

harshraj8843 opened this issue Oct 13, 2022 · 1 comment · Fixed by #5627
Assignees
Labels
closed closed issues/PRs good first issue Good for newcomers program Swift swift related

Comments

@harshraj8843
Copy link
Contributor

harshraj8843 commented Oct 13, 2022

Description

Write a Swift program to convert decimal to hexadecimal

Hexadecimal is a base-16 number system. It uses sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The digits are called hexits. A hexit is the smallest unit of information in a computer. A hexit can be used to represent a single value, such as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, or F, or it can be used to represent a single state, such as on or off.

To convert a decimal number to hexadecimal, we can use the following algorithm:

  1. Divide the decimal number by 16.
  2. Write down the remainder.
  3. Divide the quotient by 16.
  4. Write down the remainder.
  5. Repeat steps 3 and 4 until the quotient is 0.
  6. The hexadecimal number is the sequence of remainders written in reverse order.
Input  : 10
Output : A
How to contribute
  • Save the solution in program/program/convert-decimal-to-hexadecimal/program/ConvertDecimalToHexadecimal.swift file
@harshraj8843 harshraj8843 added good first issue Good for newcomers Swift swift related labels Oct 13, 2022
@harshraj8843 harshraj8843 transferred this issue from codinasion/codinasion May 28, 2023
@harshraj8843 harshraj8843 changed the title Write a Swift program to convert decimal to hexadecimal [Program]: Write a Swift program to convert decimal to hexadecimal May 30, 2023
@David-FR
Copy link
Contributor

David-FR commented Apr 8, 2024

!assign

@codinasion-bot codinasion-bot bot added the closed closed issues/PRs label Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed closed issues/PRs good first issue Good for newcomers program Swift swift related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants