Scientific Notation

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:


#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;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s