How to develop a program using C language to convert 8-bit
binary values to decimals. TQ
Answer / bashar khawaldeh
int arr[8];
int sum = 0;
int n = sizeof(arr) / sizeof(arr[0]);//24/4=6
for (int i = 0; i < n; i++) {
cout << "enter binary number
" << "index " << i << ":";
cin >> arr[i];
}
for (int i = 0; i < n; i++) {
if (arr[i] == 1) {
sum += pow(2,i);
}
}
cout << sum << endl;
Is This Answer Correct ? | 0 Yes | 0 No |
what is the large sustained error signal that eventually cause the controller output to drive to its limit
which typw of errors ? & how to solve it ?
what is the error in the following code: main() { int i=400,j; j=(i*i)/i; }
char* f() return "hello:"; void main() {char *str=f(); }
void main() { for(int i=0;i<5;i++); printf("%d",i); } What is the output?..
32 Answers College School Exams Tests, CTS, HCL, iGate, SmartData,
2. A student studying Information Technology at Polytechnic of Namibia is examined by coursework and written examination. Both components of assessment carry a maximum of 50 marks. The following rules are used by examiners in order to pass or fail students. a. A student must score a total of 40% or more in order to pass (total = coursework marks + examination marks) b. A total mark of 39% is moderated to 40% c. Each component must be passed with a minimum mark of 20/50. If a student scores a total of 40% or more but does not achieve the minimum mark in either component he/she is given a technical fail of 39% (this mark is not moderated to 40%) d. Grades are awarded on marks that fall into the following categories. Mark 100-70 69-60 59-50 49-40 39-0 Grade A B C D E Write a program to input the marks for both components (coursework marks out of 50 and examination marks out of 50), out put the final mark and grade after any moderation. [30]
What is the code for following o/p * * * * * * * * * * * * * * * *
how to convert decimal to hexadecimal without using arrays just loops
class test { int a; public: test(int b):a(b){} void show(){ cout<<a; } }; void main() { test t1; test t2(5); t1.show(); t2.show(); } }
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?
quoroum of computer languages?