How can I print the output as 123.4e+04 by increasing the number of digits before the comma instead of 1.234e+06 when using scientific notation in c
I tried the %*.*e representations, as shown below, but it didn't work. It shows any result as a single digit before the comma.
#include <stdio.h>
int main() {
double num =12340000;
printf("%1.1e\n", num);
printf("%2.1e\n", num);
printf("%2.2e\n", num);
printf("%3.1e\n", num);
printf("%4.1e\n", num);
printf("%5.1e\n", num);
printf("%5.2e\n", num);
printf("%6.3e\n", num);
printf("%8.4e\n", num);
printf("%3.0e\n", num);
}
1.2e+07
1.2e+07
1.23e+07
1.2e+07
1.2e+07
1.2e+07
1.23e+07
1.234e+07
1.2340e+07
1e+07