You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
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:
Divide the decimal number by 16.
Write down the remainder.
Divide the quotient by 16.
Write down the remainder.
Repeat steps 3 and 4 until the quotient is 0.
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
The text was updated successfully, but these errors were encountered:
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
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:
How to contribute
program/program/convert-decimal-to-hexadecimal/program/ConvertDecimalToHexadecimal.swift
fileThe text was updated successfully, but these errors were encountered: