How to make program that show the result of two program line up horizontally

There are two different program that use loop, I want to make program that show both of two program result line up horizontally, what im confuse is both of them use for loop function so when debug it, the first program will show all the result vertically then continue to second program. I tried to use nested loop to print row as outside loop but the number of iteration of two program is different so i cant unify it.

output = https://ibb.co/gw1tAk

for ( init; condition; increment ) {
   statement(s);
          }

Or maybe use array(?)

first program :
int main()
{
float x;
int i;
for(i=0;i<=100;i++) {
x=i/100.0;
printf("x=%f\n",x);
}
return 0;
}

second program:
int main()
{
float x;
for(x=0.0;x<=1.0;x+=0.01)
{
printf("x=%f\n",x);
}
return 0;
}

cant unify the loop(?) since the first one will iterate 109 times(?) and the second program 101 times

Comments

  • Both has same amount of iterations.

    #include <stdio.h>
    
    int main () {
        float x;
        int i;
        for (x = 0.0, i = 0; x <= 1.0; x += 0.01, i++) {
            printf("x=%f x=%f\n", x, i/100.0);
        }
        return 0;
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion