For Loop in C Programming || CodeTextPro - CodeTextPro | Web Tutorial | Technology

CodeTextPro.com Provides - Web design, Technology gyan, Digital marketing, Online earnings, Seo, Adsense, Technology news, Motivation and inspiration, Latest Technology Affairs, Gadgets, Blogging

Wednesday, January 16, 2019

For Loop in C Programming || CodeTextPro

Loops are used for programming to repeat a specific block of code. After reading this article, you will learn how to create for loop in C programming.

For Loop

Loops are used in programming to repeat a block of code until a specific condition is met. There are three loops in C programming:-


  1. For Loop
  2. While Loop
  3. Do-While Loop


Print 1 to 10 Number using for loop in C Programming

#include<stdio.h>

#include<conio.h>

main()

{

 int i;

 for(i=1;i<=10;i=i+1)

 {

  printf("%d\n",i);

 }

 getch();

}


Print 1 to 10 in C using for loop



Print 1 to 5 Number using for loop in C Programming


#include<stdio.h>

#include<conio.h>

main()

{

 int i;

 for(i=1;i<=5;i=i+1)

 {

  printf("%d",i);

 }

 getch();

}


Print 1 to 5 in C using for loop




Print 1 to 100 Number using for loop in C Programming


#include<stdio.h>

#include<conio.h>

main()

{

 int i;

 for(i=1;i<=100;i=i+1)

 {

  printf("%d\t",i);

 }

 getch();

}



Print 1 to 100 in C using for loop

No comments:

Post a Comment