'For' Loop Vs. 'While' Loop
Actually i tried writing the following programs the 'for' loop is giving the correct answer but 'while' loop is not compiling correctly .Can some body explain the following programs.I think both programs are one and the same.
For WHILE loop:
For WHILE loop:
int i; i=1; while(i<=10) printf("%d\n",i); i++; system("pause"); return 0;For FOR loop:
int i; for(i=1;i<=10;i++ ) printf("%d\n",i); system("pause"); return 0;
0