Basic C formatting issue

For this assignment I want my program to output the requested output. My issue lies in the formatting. Link to the problem in question:

The output of the program:

For whatever reason my x value is not increasing by a factor of ten and as far as the spacing is concerned I am not sure what I am doing wrong.

#include <stdio.h>

//declare global variables
    int x = 1;
    double num = .1234;

//prototype functions
partA(double num);

int main() {
    double a;
    a = partA(num);

/*First Function, x and num increase by a factor
of ten. */ 
partA(double num) {
    for(x; x <= 10000; x *= 10) {
        for (num; num <= 1234; num *= 10) {
            printf("%d%4lf\n",x, num);


After accepted answer. This one uses fields widths and not spaces as required by the post.

#include <stdio.h>

void partAB(const char *format, double num) {
  double d = 1.0;
  for (int i = 0; i<5; i++) {
     printf(format, d, num);
     d *= 10;
     num *= 10;

void partA(double num) {
  partAB("%5.0lf  %.4lf\n", num);

void partB(double num) {
  partAB("%5.0lf  %9.3le\n", num);

int main() {
  double x = 0.1234;
  return 0;

The spacing is because only outer loop is executing which contains printf

this code:

#include <stdio.h>

int ee(int e){
  int i, ret;
    ret *= 10;
  return ret;

int main(void) {
  int i;
    printf("%5d %.4f\n",ee(i), 0.1234 * ee(i));
    printf("%5d %.3e\n",ee(i), 0.1234 * ee(i));


    1 0.1234
   10 1.2340
  100 12.3400
 1000 123.4000
10000 1234.0000

    1 1.234e-01
   10 1.234e+00
  100 1.234e+01
 1000 1.234e+02
10000 1.234e+03

It is not increasing because you have a For inside another For, you have to increment X inside the For of "num"

Something like:

int x = 1;
for (num; num <= 1234; num *= 10)
    printf("%5d%3s%4lf\n",x, " ", num);


Edit: before I forgot the spaces, it should be fine now

Without if, switch and spaces and tabs in printf format it will be like this

partA(double num) {
    const int const max = 10000;
    const int const precision = 4;
    int width = 1 + log((float)max) / log(10.0f);
    for(; x <= max; x *= 10, num *= 10) {
        printf("%*d%c%.*f\n", width, x, 040, precision, num);

See the documentation for printf format strings.

To change the number of digits after the decimal point, specify the precision.

To get a space between the numbers, use a literal space in the format string, as in

printf("%d %4lf\n",x, num);

Need Your Help

update query with inner join access vba code

vba ms-access access-vba inner-join

I am trying to update a table from another one via a inner join query access vba. The field's name to be updated will be taken in a form.

How to handle "org.openqa.selenium.WebDriverException: ChromeDriver only supports characters in the BMP" exception?

java google-chrome selenium

Whenever I try to fill some non BMP character like '🏀' as input to a text area using selenium, my chrome driver fails due to following exception: