Professional Documents
Culture Documents
Practicals (CE-4 Batch-B4)
Practicals (CE-4 Batch-B4)
Task Ask user to choose one form given number system :Binary, Octal, Decimal,
Hexadecimal.
else if(x==3){
numberStored2[i]=3;
}
else if(x==4){
numberStored2[i]=4;
}
else if(x==5){
numberStored2[i]=5;
}
else if(x==6){
numberStored2[i]=6;
}
else if(x==7){
numberStored2[i]=7;
}
else if(x==8){
numberStored2[i]=8;
}
else if(x==9){
numberStored2[i]=9;
}
else if(x==10){
numberStored2[i]='A';
}
else if(x==11){
numberStored2[i]='B';
}
else if(x==12){
numberStored2[i]='C';
}
else if(x==13){
numberStored2[i]='D';
}
else if(x==14){
numberStored2[i]='E';
}
else if(x==15){
numberStored2[i]='F';
}
j=i;
numberDec2=numberDec2-x;
}
cout<<".";
for(i=0;j>=0;j--){
cout<<numberStored2[i];
i++;
}
}
else{}
return 0;
}
int main()
{
int a;//binary,oct,hexa.....
cout<<"Which number system you want to choose to convert ";
cin>>a;
double numberDec;
cout<<"Enter the in Decimal ";
cin>>numberDec;
if(a==2){
Binary(numberDec);
}
if(a==8){
Octal(numberDec);
}
if(a==16){
Hexan(numberDec);
}
return 0;
}
Output