forked from inspirezonetech/TeachMeCLikeIm5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfor-loops.c
27 lines (26 loc) · 881 Bytes
/
for-loops.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
------------------------------------------------------------------------------------
Tutorial: A for Loop is used to repeat a specific block of code a known number of times.
Syntax: for ( initialize; condition; increment/decrement )
{
statement(s) / code;
}
------------------------------------------------------------------------------------
*/
#include <stdio.h>
int main()
{
int i;
// for loop execution
for (i = 0; i < 10; i++)
{
printf("Value of i: %d\n", i);
}
// loop executes and values of i, from 0 to 9, are printed on new lines.
return 0;
}
/*
------------------------------------------------------------------------------------
Challenge: Use a for loop to add nubers from 1 to 10.
------------------------------------------------------------------------------------
*/