ANSWERS:
As per your requirement here is the c++ code to convert an integer to hex and terminating the code if the user enters 0
Raw code:
#include<iostream> //input output stream
using namespace std; //name space standard
void Hex(int n) //hex function with one parameter
{
char hexa_Decima_Number[100]; //char array to store the resultant hexa hexa_Decima_Number
int i = 0; //count variable
while(n!=0)//while loop
{
int temp_value = 0; //temp_value as 0
temp_value = n % 16; // store remainder in temp_value variable.
if(temp_value < 10) // check if temp_value < 10
{
hexa_Decima_Number[i] = temp_value + 48; //converstion of values using ascii
i++; //incrementing i value
}
else//else condition
{
hexa_Decima_Number[i] = temp_value + 55; //to convert character values using ascii
i++; //incrementing
}
n = n/16; //because its hex means 16
}
cout<<"Hexa Decimal value= ";
for(int k=i-1; k>=0; k--) //to get hexa_Decima_Number in reverse order
cout <<hexa_Decima_Number[k]; //printing
}
int main() //main
{
int n = 1; //initialize n as 1
while(n){//while it runs infinitely because it is a true always
cout<<"Enter a positive integer: ";//prompt the user to enter integer
cin>>n;//taking input from user
if(n==0){ //if user enters 0 break the loop
cout<<"\nDone!";
break;//break
}
Hex(n);//calling the function by sending user input as parameter
cout<<endl; //to print on next line
}
return 0;
}
code in the editor:

output:

Feel free to comment in the comment section if you have any doubts or queries.
Thank you! doupvote.
For integer n € {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) function hex(n) returns hexadecimal character from F. Write function hex and...
In Java, write a recursive method that converts an integer to hexadecimal. The function should print out the hexadecimal character instead of returning the character. Write a test program that prompts the user to enter an integer and displays its hexadecimal equivalent.
[Using Python] Write a program to convert a hexadecimal number to its decimal value. (Reminder: hexadecimal numbers are 0 through 9, A,B,C,D,E,F. hex(A) = 10, hex(F) = 15). example outputs: 1. `Enter a hex number: f` `The decimal value for hex number f is 15` 2. `Enter a hex number: g` `Incorrect hex number` 3. `Enter a hex number: 091c` `The decimal value for hex number 091c is 2332` 4. `Enter a hex number: 091g` `Incorrect hex number` Hints: you...
Write a function that returns the number of digits in an integer using the following header: int getSize(int n) For example, getSize(45) returns 2, getSize(3434) returns 4, getSize(4) returns 1, and getSize(0) returns 1. Write a test program that prompts the user to enter an integer and displays its size.
(In c++) Write a void function that receives an unsigned integer value and displays the hex representation of value. You must use bit manipulation techniques. Note that you must convert the hex value for each 4 bits starting at the right side. The hex value for 0 to 9 is the same digit. The hex value for 10 is A for 11 is B, for 12 id C, for 13 is D, for 14 is E and for 15 is...
Write a program that reads in two hexadecimal numbers from a file, hex.dat, and prints out the sum of the two numbers in hexadecimal. (As noted in class, first do this without using a file and by reading using the cin > > command) From Wikipedia: "In mathematics and computer science, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0-9 to...
[Using Python] Write a program to convert a hexadecimal number to its decimal value using the ord builtin function (Reminder: hexadecimal numbers are 0 through 9, A,B,C,D,E,F. hex(A) = 10, hex(F) = 15). example outputs: 1. `Enter a hex number: f` `The decimal value for hex number f is 15` 2. `Enter a hex number: g` `Incorrect hex number` 3. `Enter a hex number: 091c` `The decimal value for hex number 091c is 2332` 4. `Enter a hex number: 091g`...
Using python Write a Python function called sgm that requests a positive integer n and returns the series geometric mean of the numbers 1,2,3, . . . n. For example sgm(5) = (5 x 4 x 3 x 2 x 1)1/5 = (120) 1/5 = 2.605 . Write the program so that a user is requested for a positive integer and program prints the series geometric mean of the integer. Example execution: Enter number: 5 series geometric mean of 5...
write programs with detailed instructions on how to
execute.
code is java
What you need to turn in: You will need to include an electronic copy of your report (standalone) and source code (zipped) of your programs. All programming files (source code) must be put in a zipped folder named "labl-name," where "name" is your last name. Submit the zipped folder on the assignment page in Canvas; submit the report separately (not inside the zipped folder) as a Microsoft Word...
1. DOES A DIGIT APPEAR IN AN INTEGER, Write a recursive function appears(n,i) that returns true if the digit i appears in the positive (base 10) integer n, false if it does not in c++. ex. Enter a positive integer: 54321 Enter a digit: 7 The digit 7 does NOT appear in the integer 54321. 2. IS AN INPUT STRING A PALINDROME? A palindrome is a string in which the letters are the same in both directions, disregarding capitalization and...
PYTHON: (Sum the digits in an integer using recursion) Write a recursive function that computes the sum of the digits in an integer. Use the following function header: def sumDigits(n): For example, sumDigits(234) returns 9. Write a test program that prompts the user to enter an integer and displays the sum of its digits. Sample Run Enter an integer: 231498 The sum of digits in 231498 is 27