Declare main as returning an int. You should indent your code properly, e.g.,
Code:
#include <stdio.h>
int main(void)
{
int i, j, k, m = 0;
for (i = 1; i <= 5; i += 2)
{
for (j = 1; j <= 4; j++)
{
k = i + j;
printf("i=%3d, j=%3d, k=%3d\n", i, j, k);
}
}
return 0;
}
Code:
#include <stdio.h>
int main(void)
{
int count = 3, times = 1;
for (times; times <= 5; times += 1)
{
for (count; count <= 99; count += 3)
{
printf("%d ", count);
}
}
return 0;
}
Anyway, in what way do you mean "the second one (mine) isn't functioning like the first"? Clearly, they are different.
One thing to note is that just writing:
times;[/code]
evaluates the variable and does nothing. Normally, we would either leave it out because the variable already has the desired value:
Code:
for (; times <= 5; times += 1)
or we will set the desired value:
Code:
for (times = 1; times <= 5; times += 1)