SlideShare a Scribd company logo
1 of 3
Download to read offline
I want a java program that can convert a number of base 10 into its corresponding hexadecmial
char? for example it would convert 51966 to CAFE.
Solution
DecimalToHexadecimal.java
import java.util.Scanner;
public class DecimalToHexadecimal {
public static void main(String[] args) {
//Declaring variables
int decimal_no;
//Scanner object is used to get the inputs entered by the user
Scanner sc=new Scanner(System.in);
//Getting the decimal number entered by the user
System.out.print("Enter a decimal number :");
decimal_no=sc.nextInt();
toHexadecimal(decimal_no);
}
//This method will convert decimal to hexadecimal form
private static void toHexadecimal(int decimal_num)
{
int i=0;
//Declaring variables
int rem,quotient;
char hex_num[]=new char[50];
/* Assigning the user entered
* decimal number to quotient
*/
quotient=decimal_num;
/* Checking whether the quotient
* is equal to zero or not
*/
while(quotient!=0)
{
/* Finding the remainder
* after the number is divided by 16
*/
rem=quotient%16;
//converting the number into character
if(rem<10)
rem=rem+48;
else
rem=rem+55;
//Populating the characters into the array
hex_num[i]=(char)rem;
i++;
//Calculating the quotient
quotient=quotient/16;
}
//Displaying the hexadecimal number
System.out.print("The Number in Hexadecimal is :");
for(int k=i-1;k>=0;k--)
{
System.out.print(hex_num[k]);
}
}
}
_____________________
output:
Enter a decimal number :51966
The Number in Hexadecimal is :CAFE
__________Thank You

More Related Content

Similar to I want a java program that can convert a number of base 10 into its .pdf

Function in c program
Function in c programFunction in c program
Function in c programumesh patil
 
This is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdfThis is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdfindiaartz
 
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdfC++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdfandreaplotner1
 
What’s new in .NET
What’s new in .NETWhat’s new in .NET
What’s new in .NETDoommaker
 
Getting started with ES6
Getting started with ES6Getting started with ES6
Getting started with ES6Nitay Neeman
 
The java Payroll that prompts user to enter hourly rate .pdf
  The java Payroll that prompts user to enter  hourly rate .pdf  The java Payroll that prompts user to enter  hourly rate .pdf
The java Payroll that prompts user to enter hourly rate .pdfangelfashions02
 
#ifndef RATIONAL_H   if this compiler macro is not defined #def.pdf
#ifndef RATIONAL_H    if this compiler macro is not defined #def.pdf#ifndef RATIONAL_H    if this compiler macro is not defined #def.pdf
#ifndef RATIONAL_H   if this compiler macro is not defined #def.pdfexxonzone
 
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfDigits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfannapurnnatextailes
 
chapter-7 slide.pptx
chapter-7 slide.pptxchapter-7 slide.pptx
chapter-7 slide.pptxcricketreview
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with codekamal kotecha
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programmingIcaii Infotech
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C ProgrammingShuvongkor Barman
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4Saranya saran
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operatorSAFFI Ud Din Ahmad
 

Similar to I want a java program that can convert a number of base 10 into its .pdf (20)

Function in c program
Function in c programFunction in c program
Function in c program
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
C function
C functionC function
C function
 
This is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdfThis is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdf
 
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdfC++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
C++ code only(Retrieve of Malik D., 2015, p. 742) Programming Exer.pdf
 
Java doc Pr ITM2
Java doc Pr ITM2Java doc Pr ITM2
Java doc Pr ITM2
 
PROGRAMMING QUESTIONS.docx
PROGRAMMING QUESTIONS.docxPROGRAMMING QUESTIONS.docx
PROGRAMMING QUESTIONS.docx
 
What’s new in .NET
What’s new in .NETWhat’s new in .NET
What’s new in .NET
 
Getting started with ES6
Getting started with ES6Getting started with ES6
Getting started with ES6
 
The java Payroll that prompts user to enter hourly rate .pdf
  The java Payroll that prompts user to enter  hourly rate .pdf  The java Payroll that prompts user to enter  hourly rate .pdf
The java Payroll that prompts user to enter hourly rate .pdf
 
#ifndef RATIONAL_H   if this compiler macro is not defined #def.pdf
#ifndef RATIONAL_H    if this compiler macro is not defined #def.pdf#ifndef RATIONAL_H    if this compiler macro is not defined #def.pdf
#ifndef RATIONAL_H   if this compiler macro is not defined #def.pdf
 
CS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUALCS2309 JAVA LAB MANUAL
CS2309 JAVA LAB MANUAL
 
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdfDigits.javapackage week04;import java.util.Scanner; public cla.pdf
Digits.javapackage week04;import java.util.Scanner; public cla.pdf
 
chapter-7 slide.pptx
chapter-7 slide.pptxchapter-7 slide.pptx
chapter-7 slide.pptx
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Assignment c programming
Assignment c programmingAssignment c programming
Assignment c programming
 
Presentation on Function in C Programming
Presentation on Function in C ProgrammingPresentation on Function in C Programming
Presentation on Function in C Programming
 
Functions and pointers_unit_4
Functions and pointers_unit_4Functions and pointers_unit_4
Functions and pointers_unit_4
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator
 

More from fashiongallery1

For this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdfFor this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdffashiongallery1
 
Discuss the character and impact of the economic and legal revouluti.pdf
Discuss the character and impact of the economic and legal revouluti.pdfDiscuss the character and impact of the economic and legal revouluti.pdf
Discuss the character and impact of the economic and legal revouluti.pdffashiongallery1
 
Discrete Math -Use induction to prove. The city of Inductionapolis.pdf
Discrete Math -Use induction to prove. The city of Inductionapolis.pdfDiscrete Math -Use induction to prove. The city of Inductionapolis.pdf
Discrete Math -Use induction to prove. The city of Inductionapolis.pdffashiongallery1
 
Describe polarization and why it is important to WLANs.Solution.pdf
Describe polarization and why it is important to WLANs.Solution.pdfDescribe polarization and why it is important to WLANs.Solution.pdf
Describe polarization and why it is important to WLANs.Solution.pdffashiongallery1
 
Describe the four basic elements of most communication systems.So.pdf
Describe the four basic elements of most communication systems.So.pdfDescribe the four basic elements of most communication systems.So.pdf
Describe the four basic elements of most communication systems.So.pdffashiongallery1
 
Can someone please help me figure out how to do this Required Resou.pdf
Can someone please help me figure out how to do this Required Resou.pdfCan someone please help me figure out how to do this Required Resou.pdf
Can someone please help me figure out how to do this Required Resou.pdffashiongallery1
 
Assume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdf
Assume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdfAssume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdf
Assume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdffashiongallery1
 
All computer are configured for TCPIP connectivity. This exercise i.pdf
All computer are configured for TCPIP connectivity. This exercise i.pdfAll computer are configured for TCPIP connectivity. This exercise i.pdf
All computer are configured for TCPIP connectivity. This exercise i.pdffashiongallery1
 
4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdf
4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdf4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdf
4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdffashiongallery1
 
Briefly Explain all these points belowA. Marketing channels VS cha.pdf
Briefly Explain all these points belowA. Marketing channels VS cha.pdfBriefly Explain all these points belowA. Marketing channels VS cha.pdf
Briefly Explain all these points belowA. Marketing channels VS cha.pdffashiongallery1
 
Write a class that implements the BagInterface. BagInterface should .pdf
Write a class that implements the BagInterface.  BagInterface should .pdfWrite a class that implements the BagInterface.  BagInterface should .pdf
Write a class that implements the BagInterface. BagInterface should .pdffashiongallery1
 
write an equation for the transformation of the graph of y =f(x) tra.pdf
write an equation for the transformation of the graph of y =f(x) tra.pdfwrite an equation for the transformation of the graph of y =f(x) tra.pdf
write an equation for the transformation of the graph of y =f(x) tra.pdffashiongallery1
 
Using c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdfUsing c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdffashiongallery1
 
Why are helper T-cells called helper cellsThey help pathogens i.pdf
Why are helper T-cells called helper cellsThey help pathogens i.pdfWhy are helper T-cells called helper cellsThey help pathogens i.pdf
Why are helper T-cells called helper cellsThey help pathogens i.pdffashiongallery1
 
Which of the following is NOT true of the Sons of Liberty a. New Yor.pdf
Which of the following is NOT true of the Sons of Liberty a. New Yor.pdfWhich of the following is NOT true of the Sons of Liberty a. New Yor.pdf
Which of the following is NOT true of the Sons of Liberty a. New Yor.pdffashiongallery1
 
What made the Later Roman Economy so unstable (Bennette, Medieval E.pdf
What made the Later Roman Economy so unstable (Bennette, Medieval E.pdfWhat made the Later Roman Economy so unstable (Bennette, Medieval E.pdf
What made the Later Roman Economy so unstable (Bennette, Medieval E.pdffashiongallery1
 
What data would illustrate whether these underlying problems are occ.pdf
What data would illustrate whether these underlying problems are occ.pdfWhat data would illustrate whether these underlying problems are occ.pdf
What data would illustrate whether these underlying problems are occ.pdffashiongallery1
 
1. What are distinct characteristics of baby boomers, generation X, .pdf
1. What are distinct characteristics of baby boomers, generation X, .pdf1. What are distinct characteristics of baby boomers, generation X, .pdf
1. What are distinct characteristics of baby boomers, generation X, .pdffashiongallery1
 
VERSION The cells denoted by the letter Ain the figure to.pdf
VERSION The cells denoted by the letter Ain the figure to.pdfVERSION The cells denoted by the letter Ain the figure to.pdf
VERSION The cells denoted by the letter Ain the figure to.pdffashiongallery1
 
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdfUsing standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdffashiongallery1
 

More from fashiongallery1 (20)

For this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdfFor this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdf
 
Discuss the character and impact of the economic and legal revouluti.pdf
Discuss the character and impact of the economic and legal revouluti.pdfDiscuss the character and impact of the economic and legal revouluti.pdf
Discuss the character and impact of the economic and legal revouluti.pdf
 
Discrete Math -Use induction to prove. The city of Inductionapolis.pdf
Discrete Math -Use induction to prove. The city of Inductionapolis.pdfDiscrete Math -Use induction to prove. The city of Inductionapolis.pdf
Discrete Math -Use induction to prove. The city of Inductionapolis.pdf
 
Describe polarization and why it is important to WLANs.Solution.pdf
Describe polarization and why it is important to WLANs.Solution.pdfDescribe polarization and why it is important to WLANs.Solution.pdf
Describe polarization and why it is important to WLANs.Solution.pdf
 
Describe the four basic elements of most communication systems.So.pdf
Describe the four basic elements of most communication systems.So.pdfDescribe the four basic elements of most communication systems.So.pdf
Describe the four basic elements of most communication systems.So.pdf
 
Can someone please help me figure out how to do this Required Resou.pdf
Can someone please help me figure out how to do this Required Resou.pdfCan someone please help me figure out how to do this Required Resou.pdf
Can someone please help me figure out how to do this Required Resou.pdf
 
Assume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdf
Assume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdfAssume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdf
Assume that the Current Assets for Shine Co. as of Decebmer 31, 2011.pdf
 
All computer are configured for TCPIP connectivity. This exercise i.pdf
All computer are configured for TCPIP connectivity. This exercise i.pdfAll computer are configured for TCPIP connectivity. This exercise i.pdf
All computer are configured for TCPIP connectivity. This exercise i.pdf
 
4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdf
4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdf4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdf
4. At what temperature will a solution of 8.27 g CaCl2 in 45.0 g H2.pdf
 
Briefly Explain all these points belowA. Marketing channels VS cha.pdf
Briefly Explain all these points belowA. Marketing channels VS cha.pdfBriefly Explain all these points belowA. Marketing channels VS cha.pdf
Briefly Explain all these points belowA. Marketing channels VS cha.pdf
 
Write a class that implements the BagInterface. BagInterface should .pdf
Write a class that implements the BagInterface.  BagInterface should .pdfWrite a class that implements the BagInterface.  BagInterface should .pdf
Write a class that implements the BagInterface. BagInterface should .pdf
 
write an equation for the transformation of the graph of y =f(x) tra.pdf
write an equation for the transformation of the graph of y =f(x) tra.pdfwrite an equation for the transformation of the graph of y =f(x) tra.pdf
write an equation for the transformation of the graph of y =f(x) tra.pdf
 
Using c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdfUsing c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdf
 
Why are helper T-cells called helper cellsThey help pathogens i.pdf
Why are helper T-cells called helper cellsThey help pathogens i.pdfWhy are helper T-cells called helper cellsThey help pathogens i.pdf
Why are helper T-cells called helper cellsThey help pathogens i.pdf
 
Which of the following is NOT true of the Sons of Liberty a. New Yor.pdf
Which of the following is NOT true of the Sons of Liberty a. New Yor.pdfWhich of the following is NOT true of the Sons of Liberty a. New Yor.pdf
Which of the following is NOT true of the Sons of Liberty a. New Yor.pdf
 
What made the Later Roman Economy so unstable (Bennette, Medieval E.pdf
What made the Later Roman Economy so unstable (Bennette, Medieval E.pdfWhat made the Later Roman Economy so unstable (Bennette, Medieval E.pdf
What made the Later Roman Economy so unstable (Bennette, Medieval E.pdf
 
What data would illustrate whether these underlying problems are occ.pdf
What data would illustrate whether these underlying problems are occ.pdfWhat data would illustrate whether these underlying problems are occ.pdf
What data would illustrate whether these underlying problems are occ.pdf
 
1. What are distinct characteristics of baby boomers, generation X, .pdf
1. What are distinct characteristics of baby boomers, generation X, .pdf1. What are distinct characteristics of baby boomers, generation X, .pdf
1. What are distinct characteristics of baby boomers, generation X, .pdf
 
VERSION The cells denoted by the letter Ain the figure to.pdf
VERSION The cells denoted by the letter Ain the figure to.pdfVERSION The cells denoted by the letter Ain the figure to.pdf
VERSION The cells denoted by the letter Ain the figure to.pdf
 
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdfUsing standard libraries like stdio and sdtlib.h and using stats.h a.pdf
Using standard libraries like stdio and sdtlib.h and using stats.h a.pdf
 

Recently uploaded

Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 

Recently uploaded (20)

Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

I want a java program that can convert a number of base 10 into its .pdf

  • 1. I want a java program that can convert a number of base 10 into its corresponding hexadecmial char? for example it would convert 51966 to CAFE. Solution DecimalToHexadecimal.java import java.util.Scanner; public class DecimalToHexadecimal { public static void main(String[] args) { //Declaring variables int decimal_no; //Scanner object is used to get the inputs entered by the user Scanner sc=new Scanner(System.in); //Getting the decimal number entered by the user System.out.print("Enter a decimal number :"); decimal_no=sc.nextInt(); toHexadecimal(decimal_no); } //This method will convert decimal to hexadecimal form private static void toHexadecimal(int decimal_num) { int i=0; //Declaring variables int rem,quotient; char hex_num[]=new char[50]; /* Assigning the user entered * decimal number to quotient */ quotient=decimal_num; /* Checking whether the quotient * is equal to zero or not
  • 2. */ while(quotient!=0) { /* Finding the remainder * after the number is divided by 16 */ rem=quotient%16; //converting the number into character if(rem<10) rem=rem+48; else rem=rem+55; //Populating the characters into the array hex_num[i]=(char)rem; i++; //Calculating the quotient quotient=quotient/16; } //Displaying the hexadecimal number System.out.print("The Number in Hexadecimal is :"); for(int k=i-1;k>=0;k--) { System.out.print(hex_num[k]); } } } _____________________ output: Enter a decimal number :51966 The Number in Hexadecimal is :CAFE