for Loop :

for loop :

A for loop is used to execute and repeat a block of statements depending on a condition.

Syntax :

  1. for ( <initial value>; <condition>; <increment> )
  2. {
  3. <statement block>
  4. }

Example :

  1. /* Description: program to natural number upto N */
  2. #include<stdio.h>
  3. main()
  4. {
  5. int n,i;
  6. printf("\n Enter value to n : ");
  7. scanf("%d",&n);
  8. for(i=1;i<=n;i++)
  9. {
  10. printf("%d\n",i);
  11. }
  12. getch();
  13. }

Output :

c language - program to natural number upto N

Next Update

Loading...

Currently we improved our website User Interface and other contents. Our next update is adding video tutorials on this site so, We create a new YouTube channel, our YouTube channel name is CodeX.

We need some time for make video tutorials (CodeX) so, stay with us and keep supporting and you know already we make a Collaboration with HackIsOn YouTube channel long time ago So, please Subscribe Our Channels