C Exercises
Home
'C' Exercises ▼
Basic C Programming
If-else Statements in C
Loops in C
Arrays in C
Pattern Programs in C
Series Programs in C
String in C
Switch-case in C
Functions in C
Pointers in C
Bitwise operators in C
File handling in C
Tricky Programs in C
Projects in C ▼
C Project-1
C Project-2
Java ▼
Java Introduction
Arrays in Java
Basic Java Examples
Generics in Java
Constructor in Java
OOP's Interview Questions
▼
May 29, 2020
for loop in C
The
for loop
is a loop which is mostly used in any programming languages.
because
for loop
is
easy to use
and
understand
.
For loop
is used to repeate a specific block of code a known number of times.
Let's understand the
syntax
of for loop-
for (initialisation; condition; increment/decrement) { //statements in body of loop; }
Example: program to print series of 1 to 10 numbers using for loop.
#
include
<stdio.h>
void
main
()
{
int
i;
for
(i=1;i<=10;i++)
{
printf
(
"%d "
,i);
}
}
Above program shows the following
Output:
No comments:
Post a Comment
If you have any doubts, please discuss here...
‹
›
Home
View web version
No comments:
Post a Comment
If you have any doubts, please discuss here...