summaryrefslogtreecommitdiff
path: root/1736/CH1/EX1.4/Ch01Ex4.sce
blob: e45d0ae38eac0887e8add1ee9b924c7ba1f01bad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Scilab Code Ex1.4 : Page-17 (2006)
clc; clear;
c_by_a_ratio = 1.633;   // Ideal c/a ratio
A = cell(2,4);  // Declare a cell
// Assign values to the elements of the cell from the table
A(1,1).entries = 'Mg';
A(2,1).entries = 'Cd';
A(1,2).entries = 5.21;
A(2,2).entries = 5.62;
A(1,3).entries = 3.21;
A(2,3).entries = 2.98;
A(1,4).entries = A(1,2).entries/A(1,3).entries;
A(2,4).entries = A(2,2).entries/A(2,3).entries;
if (A(1,4).entries - c_by_a_ratio) < 0.01 then
    printf("\n%s satisfies ideal c/a ratio and %s has large deviation from this value.", A(1,1).entries, A(2,1).entries);
else if (A(1,4).entries - c_by_a_ratio) < 0.01 then
    printf("\n%s satisfies ideal c/a ratio and %s has large deviation from this value.", A(2,1).entries, A(1,1).entries);       
    end
end

// Result 
// Mg satisfies ideal c/a ratio and Cd has large deviation from this value.