Thread: for loop code
View Single Post
  #1 (permalink)  
Old 07-09-2008, 08:19 AM
payam.a payam.a is offline
Newbie
 
Join Date: Jun 2008
Posts: 12
Rep Power: 0
payam.a is on a distinguished road
Question for loop code

Hi dear friends;
I have a question about this code. please guide me.
what will happen if we don't write the first expression of the for loop.If we can write another things instead, what should we write?
please help me about this code.
thanks
payam
Code:
/* for_show.c */

#include <stdio.h>

int main(void)

{

    int num = 0;



    for (printf("Keep entering numbers!\n"); num != 6;  )

        scanf("%d", &num);

    printf("That's the one I want!\n");

    return 0;

}
this is it's output.





Keep entering numbers!

3

5

8

6

That's the one I want!

Last edited by WingedPanther; 07-12-2008 at 07:50 AM. Reason: add code tags
Reply With Quote

Sponsored Links