+ 3
Why isn't it working, can anyone help?
3 Réponses
+ 7
there is variable "i"in for loop, that is not declared and initialized: should be x not i.
for (x = 0, y = num; x < y; x++, y--)
^
+ 5
Ira Sarkar
There should be x++ not i++
Start x = 1 to get output like
1 10
2 9
3 8
4 7
5 6
Program:-
#include <stdio.h>
int main() {
int x, y, num = 10;
for (x = 1, y = num; x < y; x++, y--) {
printf("%d %d\n", x, y);
}
}