Answer:
Check the explanation
Explanation:
#include <iostream>
using namespace std;
void hex2dec(string hex_num){
int n = 0;
//Loop through all characters in string
for(int i=0;i<hex_num.size();i++){
//take ith character
char c = hex_num[i];
//Check if c is digit
if(c>='0' && c<='9'){
n = 16*n + (c-48);
}
//Convert c to decimal
else{
n = 16*n + (c-55);
}
}
cout<<hex_num<<" : "<<n<<endl;
}
int main()
{
hex2dec("EF10");
hex2dec("AA");
return 0;
}
The Output can be seen below :
<span>Processor, Main Memory, I/O Modules, System Bus</span>
Answer:
The complete code is as follows:
from array import *
myArr = array('f',[3, 5, 7,3, 10])
location = myArr.index(7)
print(str("7")+" is at position "+str(location+1))
Explanation:
I made corrections to the third line of the code and I added a line
This line gets the index of 7 from the array myArr using the index keyword
location = myArr.index(7)
This line prints the position of the 7 in the array
print(str("7")+" is at position "+str(location+1))