C Programming Tutorial – 27 – for Loop

Facebook – https://www.facebook.com/TheNewBoston-464114846956315/
GitHub – https://github.com/buckyroberts
Google+ – https://plus.google.com/+BuckyRoberts
LinkedIn – https://www.linkedin.com/in/buckyroberts
reddit – https://www.reddit.com/r/thenewboston/
Support – https://www.patreon.com/thenewboston
thenewboston – https://thenewboston.com/
Twitter – https://twitter.com/bucky_roberts


koolkid54100 says:

why are you not starting the for loop with bacon = 0. When you discussed arrays you made it very clear that an array starts at 0 not 1.

notreever says:

Thank you so much m8!

Michael Knox says:

Thank you….you make a lot of sense

Thapelo mashapa says:

joo guys i really enjoy this video learning

yerrapotu kiran says:

Thank you Bucky

Sanket Jain says:


int main()
int a, b, c;
printf(“Enter the three sides of the trianglen”);
scanf(” %d”, &a);
scanf(” %d”, &b);
scanf(” %d”, &c);

if(a == b == c){
printf(“The triangle is an equilateral trianglen”);
if(a == b != c){
printf(“The triangle is an isosceles trianglen”);
if(a != b != c){
printf(“The triangle is a scalene trianglen”);
printf(“Invalid Inputn”);
return 0;

What is wrong in this code for deciding which type of triangle is this.

Qasim Mustafa Ali says:

can’t see anything at all

Leverquin says:

is there anyway in codeblocks to see what included files stand for? like can i click somehow on and see what include?

Victor Damisa says:

pls guys what is the code for this program?

Write a program that accepts time in “seconds” format and prints it in minutes and seconds.
For example if you enter 89 it must print : 1:29 (you can use % modulus operator to compute
the remaining of a division)

Divij Arora says:

Its probably to dumb to ask but I will still ask,
for (i=0; i<=10;i+1) { printf("%d", i); } why does this give "1" infinite times?

LoveTheCreator NotTheCreation says:

can’t really see what he’s typing….

Fake vids says:

Can’t see anything in mobile please post zoomed videos

william41017 says:

someone please explain this;
why this code


int main(){

int rep;

for(rep=1; rep=10; rep++){

keeps repeating forever?

Daniel Austin says:

Thanks for your awesome videos!

zaharouni1 says:

for repeating loop  while(1){code}; and for(:::);  are very usefull for programming micocontroller like avr,arm,pic…

ying tang says:

int main()
int banana;

for(banana==5; banana<=100;banana+=8){ printf("Banana is:%dn",banana); } return 0; } If I changed the banana=0 to banana==0, the first output is 2. And no matter what number I put after==, the first output is 2 too. Wondering why.

Click here to reply says:

Enjoy this guys:
#include “stdio.h”
#include “stdlib.h”
#include “ctype.h”
#include “string.h”
#include “math.h”

int main()

int rows, columns;

for (rows = 1; rows < = 5; ++rows) { for (columns = 1; columns <= rows; ++columns) { printf("%d", columns); } printf("n"); } printf("n"); for (rows = 1; rows <= 5; ++rows) { for (columns = rows; columns > 0; –columns)
printf(“%d”, rows);



int i = 1;
for (rows = 1; rows <= 5; ++rows) { for (columns = 0; columns < rows; ++columns) { printf("%d", i); i++; } printf("n"); } return 0; }

Swapnil Achari says:

how to code for the sum of first 10 any numbers using for loop???

Aakash Thakor says:

Thank you for posting these tutorials, I am so lost in my intro to C class but these videos are helping me out!!

Rahul Sudhanaboina says:

Can we add more than three expressions in for loop?

Gouki says:


Michael Moore says:

I was trying to do something similar to bacon += 8 in an array. I was wanting to add all the odd elements and all the even elements of an array. for instance:

int array[10];
int i, evens, odds, total;

scanf("%d", &array[i]);

evens += array[i]

odds += array[i]

total = odds - evens;

printf("%d", total);

It didn't work correctly. Does that code look ok or is there a better way to do it? I ended up doing it by using
for(i=0;i<10;i++ + i++)

but i don't like the way that code looks. Surely there is a better way to write it.

yezzzsir says:

still confused with int & char I tried copying this from memory and included the “&” by mistake and got a funny result? I thought you had to include this for anything other than a string? please advise.

le00 says:

for(hi=0; hi<2; hi++ )

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!