Moderator: Board moderators
2
5
6
2^-5 = 3.125E-2
2^-6 = 1.563E-2
2
5
6
5
6
1
2^-5 = 3.125E-2
2^-6 = 1.563E-2
2^-5 = 3.125E-2
2^-6 = 1.563E-2
2^-1 = 5.000E-1

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
void main()
{
int n,i,y,caseno;
double x;
char c[10];
cin>>caseno;
while(caseno--){
if(c[0]=='\n') break;
sscanf(c,"%d",&n);
x=1; y=0;
for(i=0;i<n;i++){
if((int)x/2==0){
y++;
x*=10;
}
x/=2;
}
printf("2^-%d = %.3lfE-%d\n",n,x,y);
}
}
2^-6 = 1.56250E-2
2^-7 = 7.81250E-3
Users browsing this forum: No registered users and 1 guest