Search C Program

Print 1 to 10 using while loop

/* print 1 to 10 using while loop */

#include<stdio.h>
int main()
{
    int i=1;
    while(i <= 10)
    {
        printf("%d\n",i);
        i++;
    }
    return 0;
}

Related Post
Print 1 to 10 using for loop
http://cbasicprogram.blogspot.in/2012/02/print-1-to-10-using-for-loop.html

5 comments:

  1. no its not working in turbo c++

    ReplyDelete
    Replies
    1. In turbo CPP, use void main() instead of int main().. and leave out the return 0. It should work then

      Delete