Using for loop in programming to print hive blog 10 times : C language Programming

avatar

image.png

Hello community friends,

Greeting from @mrdani12 to all my beautiful friends, Hopefully you guys are doing well , Today I am going to share about the new topic which we learn today In programming fundamental which is loop , In this program we use loop , Loop is very important in programming , you can use loop to repeat something .

I was very happy to learn something new in my university , Loop is very important in programming , you can easy your programming with loop .

I am very excited for loops because it is very logical and important , You can repeat every thing to print as you want , Like I write this program to write the hive blog 10 time , then I use loop to print hive blog;

Their is many uses of for loop . the syntax of for loop is for (initialized ; condition; increment\decrement)
In this syntax first you have to initialized the where you are going to start the loop , like I am going to start the loop from 1, and then next thing is condition , through condition , you can give then specific condition that the loop will be run up to 10 .

image.png

This program first start from initialization it is initialize from 1, starting from 1 then it will check the condition that it is true or not yes it is true because 1 is less then ten , it will jump to printf and print the message on the screen , Then it will go to increment , previous i have value 1 and now it will add another 1 to i which value is now 2 . Then again it will check the condition , 2 is less then 10 condition is true and again it will print the hive blog , The loop will continue until the condition false , You can use this print f message as you want to wish.

lets see the result and how it will be display on screen as you guys know programming is very interesting subject because you can use your logic to solve the problem , and now we are beginner learning about the basic language which is c language , it is the mother of language.

Take a look of result , hive blog is printed on the screen 10 times.

image.png

This is all about from my today work which make me more productive and learn new thing in programming , If you want to get success you have to word hard .

Your best Regarded @mrdani12



0
0
0.000
0 comments