Solver WRITE a number in scientific notation
Algebra
->
Decimal-numbers
-> Solver WRITE a number in scientific notation
Log On
Algebra: Decimal numbers, power of 10, rounding
Section
Solvers
Solvers
Lessons
Lessons
Answers archive
Answers
Source code of 'WRITE a number in scientific notation'
This Solver (WRITE a number in scientific notation)
was created by by
ichudov(507)
:
View Source
,
Show
,
Put on YOUR site
About ichudov
:
I am not a paid tutor, I am the owner of this web site!
==section input Write *[input a=12000000] in scientific notation. ==section solution perl my $a1 = sprintf( "%E", $a ); $a1 =~ s/0+E/E/; #$a1 =~ s/E\-/E/; if( $a1 =~ s/E\-/E\(\-/ ) { $a1 =~ s/$/\)/; } #print "a1=$a1\n\n\n"; $a1 =~ s/(\+|\-)0+/$1/; $a1 =~ s/E\+/E/; $a1 =~ s/E/\*10\^/; $b1 = $a1; $b1 =~ s/\*.*//; print "Answer: {{{$a=$a1}}}" ; ==section output b1 ==section check a=12 b1=1.2