TCEA State Programming Contest

April 28, 2001

Problem 2.6 Scientific Notation

**General Statement:** Read a number in scientific notation and output its equivalent decimal value.

**Input:** All data is on a single line. The first integer indicates how many pairs of numbers follow. The first of each pair is A, the base number, and the second is E, the power of 10.

**Output:** Round each answer to 2 decimal places. Trailing zeros to the right of the decimal point are required. A leading zero to the left of the decimal point is not required.

The output is to be formatted exactly like that for the sample output given below.

**Assumptions:** E is in the range –10 .. 10. A is 1 or larger but less than 10.

**Discussion:** If A = 3.926 and E = 4, the number represented is 3.926 X 104 or 39260, which is 39260.00 when rounded to 2 decimal places.

**Sample Input:** 4 4.296 3 3.8 -2 1.8 2 2.8678 1

**Sample Output:**

4296.00

0.04

180.00

28.68

**Solutions:**

#include <stdio.h>
#include <math.h>
int main ()
{
int dataSet;
scanf ("%d", &dataSet);
while ( dataSet-- ) {
double base;
scanf ("%lf", &base);
int power;
scanf ("%d", &power);
printf ("%.2lf\n", base * pow (10, power) );
}
return 0;
}

### Like this:

Like Loading...

*Related*

## Published by Shahab

Completed B.Sc in CSE, @United International University, Dhaka.
Currently working as Development Engineer, Android and iOS Application.
View all posts by Shahab