
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
I need the following problems worked out (show work). Thee answers are provided, I just need the work explained briefly for each one. 4 - What is the decimal representation of each of the following unsigned binary integers? a. 00110101 (53) b. 10010110 (150) c. 11001100 (204) 6 - What is the sum of each pair of binary numbers? a. 10101111 + 11011011 (110001010) b. 10010111 + 11111111 (110010110) c. 01110101 + 10101100 (100100001) 8 - How many bits are...
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...
For this assignment, you will apply what you learned in analyzing for, while, and do-while loops by writing these statements yourself. The Java™ program you write should do the following: Display a pyramid of asterisks onscreen (i.e., a nested for loop) Display the integers 10 to 1 in decreasing order, one number per line (i.e., a while/do-whlie loop) Add 7 until the sum becomes greater than 157, at which point the program should display both the sum and the number...
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.
In C++ Programming, Try using loops only. This lab demonstrates the use of the While Loop and the Do While Loop as error checking mechanisms. You will be using each of these loops to solve the same problem. Please put them both in the same program. When you test the code, you will not see a difference in the way they execute - but there will be a difference in the logic when writing the code. You will want to...
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...