OEF Exercise - Reconstituer un décimal
Reconstituer un décimal
GNU GPL
Numbers
- E6
- H1
décimal décimaux numération recomposer
Reconstituer un décimal
A partir d'une décomposition canonique en somme de termes de la forme ax10^n, recomposer le nombre décimal.
\title{Reconstituer un décimal}
\language{fr}
\range{-5..5}
\author{Odile Bénassy}
\email{obenassy@free.fr}
\license{GNU GPL}
\computeanswer{no}
\format{html}
\precision{10000}
\integer{exonum=random(1..2)}
\integer{a1 = random(1..9)}
\integer{a2 = random(0..9)}
\integer{a3 = random(0..9)}
\integer{a4 = random(0..9)}
\integer{a5 = random(0..9)}
\integer{a6 = random(1..9)}
\integer{a = \a1 * 100000 + \a2 * 10000 + \a3 * 1000 + \a4 * 100 + \a5 * 10 +
\a6}
\integer{first=-9}
\integer{last=2}
\integer{exp = random(\first..\last)}
\real{x = \a * 10^\exp}
\matrix{base1 = 100000000, 10000000, 1000000, 100000, 10000, 1000, 100, 10, 1, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001, 0.00000001, 0.000000001}
\matrix{base2 = cent millions, fois dix millions, millions, cent mille, fois dix-mille, milliers, centaines, dizaines, unités, dixièmes, centièmes, millièmes, dix-millièmes, cent-millièmes, millionnièmes, dix-millionnièmes, cent-millionnièmes}
\matrix{base2unit = cent millions, fois dix millions, million, cent mille, fois dix-mille, millier, centaine, dizaine, unité, dixième, centième, millième, dix-millième, cent-millième, millionnième, dix-millionnième, cent-millionnième}\if{\exonum=1}{\matrix{base=\base1}}{\matrix{base=\base2}}
\integer{decalage=4}
\text{b1 = item(\decalage-\exp, \base)}
\if{\a1=1 and \exonum=2}{\text{b1 = item(\decalage-\exp, \base2unit)}}
\text{b2 = item(\decalage-\exp+1, \base)}
\if{\a1=0}{\text{b1=}}
\if{\a2=1 and \exonum=2}{\text{b2 = item(\decalage-\exp+1, \base2unit)}}
\if{\a2=0}{\text{b2=}}
\text{b3 = item(\decalage-\exp+2, \base)}
\if{\a3=1 and \exonum=2}{\text{b3 = item(\decalage-\exp+2, \base2unit)}}
\if{\a3=0}{\text{b3=}}
\text{b4 = item(\decalage-\exp+3, \base)}
\if{\a4=1 and \exonum=2}{\text{b4 = item(\decalage-\exp+3, \base2unit)}}
\if{\a4=0}{\text{b4=}}
\text{b5 = item(\decalage-\exp+4, \base)}
\if{\a5=1 and \exonum=2}{\text{b5 = item(\decalage-\exp+4, \base2unit)}}
\if{\a5=0}{\text{b5=}}
\text{b6 = item(\decalage-\exp+5, \base)}
\if{\a6=1 and \exonum=2}{\text{b6 = item(\decalage-\exp+5, \base2unit)}}
\if{\a6=0}{\text{b6=}}
\statement{
<p>Reconstituer le nombre décimal :
<p>
\if{\exonum=1}{
\a1 x \b1 + \a2 x \b2 + \a3 x \b3 + \a4 x \b4 + \a5 x \b5 + \a6 x \b6 = \embed{reply 1,10}
}{
\a1 \b1 + \a2 \b2 + \a3 \b3 + \a4 \b4 + \a5 \b5 + \a6 \b6 = \embed{reply 1,10}}
}
\answer{}{\x}{type=numeric}
2004-05-24 16:23:11
2005-02-18 06:27:30