for loop example in c
Example 1: loops in c
#include <stdio.h>
int main() {
int i;
for (i = 1; i < 11; ++i)
{
printf("%d ", i);
}
return 0;
}
Example 2: for loop c
for(int i = 0; i<n ;i++)
{
}
Example 3: for loop in c
int i;
for (i = 0; i < n; ++i) {
}
Example 4: for loop in c
#include <stdio.h>
int main(){
int a, b[5] = {2, 4, 5, 7, 9};
for (a = 0; a<5; a++){
printf("%d\n", b[a]);
}
}
Example 5: for statement in c
for(int i=0; i<10; i++)
printf("%d ", i)
Example 6: c make loop
#include <stdio.h>
int main()
{
int i = 1;
while (i <= 5)
{
printf("%d\n", i);
++i;
}
return 0;
}