Please do this in C++ using only for loops, while loops, and do while loops. No arrays.
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int
i,j,high,low,dnum,rem,bnum,rem1,onum,k,l,hexnum,hnum,m,rem2;
char ch;
cout<<"Enter the lowest number :\n";
cin>>low;
cout<<"Enter the hightest number :\n";
cin>>high;
//finding binary number
for(i=low;i<=high;i++)
{
dnum=i;
j=0;
bnum=0;
while(dnum!=0)
{
rem=dnum%2;
bnum+=rem*pow(10,j);
j++;
dnum=dnum/2;
}
//finding octal number
onum=0;
l=0;
for(k=i;k!=0;k=k/8)
{
rem1=k%8;
onum+=rem1*pow(10,l);
l++;
}
//finding hexadeciaml number
hexnum=0;
hnum=i;
m=0;
do
{
rem2=hnum%16;
hexnum+=rem2*pow(10,m);
m++;
hnum=hnum/16;
}
while(hnum!=0);
switch(hexnum)
{
case 10:
ch='A';
break;
case 11:
ch='B';
break;
case 12:
ch='C';
break;
case 13:
ch='D';
break;
case 14:
ch='E';
break;
case 15:
ch='F';
break;
}
//printing the result
if(hexnum<=9)
{
cout<<i<<"\t"<<bnum<<"\t"<<onum<<"\t"<<hexnum<<endl;
}
else
{
cout<<i<<"\t"<<bnum<<"\t"<<onum<<"\t"<<ch<<endl;
}
}
return 0;
}
Please do this in C++ using only for loops, while loops, and do while loops. No...
5. Write a Complete C++ program which can produce the same result as shown below, i.e. convert numbers procedurally from decimal to binary, octal and hexadecimal. Microsoft Office 365 Excel supports number conversion from one base to another, for example from Decimal to Binary, Octal, Hexadecimal etc. One such example screen shot is attached here: Binar Deci mal Hexadeci Octal mal y 010 0 0 11 2 10 2 3/11 3 4 100 4. 4 5101 5 5 6110 6...
I think you are actually doing binary to hex. please do this without loops and you can use recursion. please write a working C code. Thanks Write a loop-less function to convert from Hex to Binary. (HINT: Use a helper function/recursion) binHex[16] [5] {"0000", "O001","0010","0011","0100" ,"0101", "0110", "0111", "1000", "1001" , "1010", "1011", "1100", "1101", "1110" 1 const char = s char hexToBinary ...) 7
Lab 5-2 Nested Loops 2. Summation Of Numbers (using Nested While Loops) Part A: The program will calculate and display the total of all numbers up to a specific number (entered by the user). Only positive numbers are allowed. Part B: User-controlled loop Part A Input Validation loop Part A: Summation loop Examples: When 5 is entered the program will calculate the total as 1+2+...+5 and display 15. When 2 is enterered the program will calculate the total as 1+2...
Make a program in C that takes in four parameters, 1) string of +,- or * for addition,subtraction, or multiplication 2) 32 bit two's complement integers where a 'b' in front of it means binary, 'o' means octal 'd' means decimal, and 'x' means hexadecimal 3) another 32 bit two's complement number with the same base as the first number, so if first number was a binary the second would also be a binary 4) the type of base you...
Solve Question using While loops-MATLAB Write a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number.
Do the following number conversions assuming two's complement representation is used for binary numbers. Douto check your answers becauses mentioned in class.portul credt will not be please digit is wrong in your answer. Do not put any space between ages/bits in your answers a. (113710 - 02 (8-bit binary number) b. (-97)10 - 12 (8-bit binary number) C. (0101 11002 D10 (decimal number) d. (1010 00112 010 (decimal number e. (3C7B)16 12 (16-bit binary number) f. (0100 1011 1000 1110)2-(...
please include only the digits of the appropriate number system. In particular, do not precede the answers with ‘0x’ or ‘0b’ or follow your answers with base indicators, like subscript 2 or 10. 1. A processor uses 24 bits for its memory addressing. How many possible distinct locations (in decimal) can the computer address? The computer memory address locations are numbered from 0 to the maximum. If a memory locations' address is (7243)10, how is this address represented in binary...
NOTE: Write the Program in python as mentioned below and use while loop and flags as necessary. And please write the code following the program description given below. DON'T use Function concept or any other concept except while loop,if-else. Directions: Read the program description below carefully. All requirements must be met by your program to receive full credit. Thus, pay particular attention to input and output requirements, structural requirements, and so on. Furthermore, code that contains syntax errors will not...
NOTE: Write the Program in python as mentioned below and use while loop and flags as necessary. And please write the code following the program description given below. Directions: Read the program description below carefully. All requirements must be met by your program to receive full credit. Thus, pay particular attention to input and output requirements, structural requirements, and so on. Furthermore, code that contains syntax errors will not receive any credit, so be sure that your code interprets correctly...
The place values for the eight binary digits used in IPv4 addressing are as follows: 128, 64, 32, 16, 8, 4, 2, 1. Expand this range to include an additional four bits. Do this by recording the place values for 211, 210, 29, and 28. 1111 Express the decimal value 2001 in binary by placing 1s in the binary positions requiring the addition of the corresponding place value. Place 0s in the binary positions where the corresponding place value should...