SET OF PROGRAMS

This blog provided "C" programs for beginners. Providing c programs for students.enjoy this blog.this blog include many c programs for engineering students, IT engineering students and programmers this blog is very useful.this blog post daily 1-5 programs for you.this programs use full for devlop games devlops application and much more. This blog programs useful for projects because all programs post with explanations.

Search Bar

Ads Here

Friday, 4 May 2018

C program for print 1 to 100 numbers


#include<stdio.h>
main()
{
   int i;
   for(i=1;i<=100;i++)
   {
      printf("%d\n",i);
   }
}
Output:
1

3
4
5
.
.
.
.
.
100

Explanation:

1.)initialises i as an integer.

2.)Now i=1 and is lesser than 100 so condition satisfies and prints the value of i which is 1.

3.)Now i is incremented to '2' and again it is less than 100 so condition satisfies and prints the value of iwhich is '2'.

4.)It goes like that until i is equal to 100 and it is equal to 100 so it prints 100 than the value of i is incremented to 101 which dissatisfies the condition causing to come out of the loop.

5. As there are no statements out of the loop the program terminates. 

No comments:

Post a Comment