COLLABRAINS-Editorials 4

PROBLEM CODE
VIEW2004
PROBLEM LINK:
https://www.codechef.com/QTCC2020/problems/VIEW2004

DIFFICULTY:
Easy

PREREQUISITES:
math

PROBLEM :
Read a number in scientific notation and output its equivalent decimal value.

EXPLANATION:
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.
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.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.

SOLUTIONS:

Summary

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

}

Feel free to Share your approach.Suggestions are welcomed as always had been. :slight_smile: