summaryrefslogtreecommitdiff
path: root/3836/CH5/EX5.1/Ex5_1.sce
blob: 5c096fca78038865f44626cd451af3e0706079a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear
//Initialisation
n=8                                 //8 bit
n2=16                               //16 bit
n3=32                               //32 bit

//Calculation
c=2**n                               //value for 8 bit
c2=2**n2                             //value for 16 bit
c3=2**n3                             //value for 32 bit

//Result
printf("\n An 8-bit word can take 2^8 = %d values\n",c)

printf("\n An 16-bit word can take 2^16 = %d values\n",c2)

printf("\n An 32-bit word can take 2^32 = %f x 10^9 values\n",c3/10**9)