|
Post by danuthorincas on Jun 21, 2019 7:56:54 GMT
"I want to run the program for 4 value for E:233.8,254.3 ,163.2 and 218 "
A=40 'capat A
B=40 'capat A
C=2.3 'grosime pinza
D=0.25 'sanfren capat
E=233.8 'lungime piesa
For i=5 to 8.5 step 0.05
N=(i*1000-A-B)/(E+2*D+C)
M=i*1000/(INT(N)*E)
iF M<1.04 THEN
PRINT USING("####",N );TAB(25);i;TAB(55);USING("####.####",M )
END IF
next
|
|
|
Post by tsh73 on Jun 21, 2019 11:57:46 GMT
You don't actually *need* array. You can use DATA/READ
data 233.8,254.3,163.2, 218
for j = 1 to 4 read E print "E=";E next
and put your calculation code into loop by 'j'
A=40 'capat A B=40 'capat A C=2.3 'grosime pinza D=0.25 'sanfren capat 'E=233.8 'lungime piesa data 233.8,254.3,163.2, 218
for j = 1 to 4 read E print " E=";E;" ---------------------------------------" For i=5 to 8.5 step 0.05 N=(i*1000-A-B)/(E+2*D+C) M=i*1000/(INT(N)*E) iF M<1.04 THEN PRINT USING("####",N );TAB(25);i;TAB(55);USING("####.####",M ) END IF next next
|
|
|
Post by jarych on Jun 22, 2019 1:58:03 GMT
"I want to run the program for 4 value for E:233.8,254.3 ,163.2 and 218 " A=40 'capat A B=40 'capat A C=2.3 'grosime pinza D=0.25 'sanfren capat E=233.8 'lungime piesa For i=5 to 8.5 step 0.05 N=(i*1000-A-B)/(E+2*D+C) M=i*1000/(INT(N)*E) iF M<1.04 THEN PRINT USING("####",N );TAB(25);i;TAB(55);USING("####.####",M ) END IF next Not really a functioning example program but something this way ---- DIM E(5)
for i=1 to 4 read Ekonstant let E(i)=Ekonstant next i You could then use the array elements in another loop to perform your computations, but you might then want one or two additional arrays, or maybe a multidimensional array to take those results.
|
|
|
Post by jarych on Jun 22, 2019 11:31:27 GMT
I might be misunderstanding the initial program you proposed but here is the adaptation based on tsh73's example.
dim E(5) 'in addition to just variable E data 233.8,254.3,163.2, 218
for j = 1 to 4 read E let E(j)=E print "E=";E next
A=40 'capat A B=40 'capat A C=2.3 'grosime pinza D=0.25 'sanfren capat 'E=233.8 'lungime piesa data 233.8,254.3,163.2, 218
for j = 1 to 4 'read E print " E=";E;" ---------------------------------------" For i=5 to 8.5 step 0.05 N=(i*1000-A-B)/(E(j)+2*D+C) M=i*1000/(INT(N)*E(j)) iF M<1.04 THEN PRINT USING("####",N );TAB(25);i;TAB(55);USING("####.####",M ) END IF next next
|
|