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 |
#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
what is run time error?
what is meant by linking error? how can i solve it? if there is a linking error " unable to open file 'cos.obj'? then what should i do?
what are the techniques for reducing the fragility of a memory bug?
full c programming error question based problem
what is the error in the following code: main() { int i=400,j; j=(i*i)/i; }
what is syntax error?
void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
void main() { int i=7; printf("N= %*d",i,i); }
Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly