I've tried to refractor my very very easy programm (I'm beginner, sorry for stupidity). I wanted to put scanf() into first paragraph of loop initialization and I thought that everything would have been alright but it doesn't work as I had "predicted". The programm should get and intiger and then write following numbers till the last number would be 10 times bigger tahn the first one but instead of this it writes out numbers from 1 to the number 10 times bigger. I would be grateful for any tips and debugg. Have a nice day!
Code:
#include <stdio.h>
int main()
{
int x, i;
printf("Please put intiger:\n");
for(i = (scanf("%d", &x)); i < x + 10; i++)
printf("%d\n", i);
return 0;
}
Execution:
Please put intiger: 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Press any key to continue . . .