=> Program :
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int decNum,rem,i=0;
cout<<"Enter the Decimal Number : "<<endl;
cin>>decNum;
char hexVal[100];
while(decNum){
rem=decNum%16;
if(rem<10){
hexVal[i++] = 48 + rem;
}else{
hexVal[i++] = 55 + rem;
}
decNum=decNum/16;
}
cout<<"HEXA DECIMAL NUMBER : ";
for(int j=i-1;j>=0;j--){
cout<<hexVal[j];
}
cout<<endl;
}
=> Output :
Comments
Post a Comment