Assalam-o-Alaikum!
How are you all guys . Hopefully you all are great and enjoying a great and blessed life with the grace of GOD. And I also want to appreciate all of your efforts . Whether the efforts is in education post or in tutorials or in lectures. And I also know that these all are time taken posts. Because I already posted lectures
And today I am here again with my new lecture. I will share very easy method. I hope that you will understand clearly.
So let's Started!
I will share how to use loops. and how to use while loop in our simple program. Its not difficult if we understand with full focus
Let’s we have a situation that we want print word HELLO WORLD. But we want to print it for five times. First we have a simple program
And the result is:
It was easy, but then again, let's consider another situation when you want to write Hello, World! A thousand times. We certainly can't write print f () statements a thousand times. All advanced programming languages provide different types of loops, which can be used to perform one or more statements repeatedly
Now we will see this same program by using while loop and then we see the result again
![image.png](https://steemitimages.com/640x0/https://cdn.steemitimages.com/DQmSVZ3bfKyLj5e5d1UWGf9epf4TazAPzFW9ZxKLTXBJaaE/image.png)
Here, the computer first checks whether the given condition, i.e. the variable "a" is less than 5 and if it knows that the condition is correct, then the loop body is entered to follow the given statement. The first statement is the printf () function, which prints Hello World!. The second statement is i = i + 1, which is used to increase the value of the variable i.
Center>
Once you are clear about these two loops, you can pick up the C programming tutorial or a reference book and check out the other loops available in C and how they work
A while loop starts with the keyword and then closes with a condition ()
Next to the while () statement, you have the body of the loop enclosed in a curved brace * ... *.
While in loop body one or more lines of source code can be run repeatedly
If there is only one line in the body of the short loop, it is optional to use its curved braces {....
- One while the loop continues to perform its body until a given condition is corrected. As soon as the condition goes wrong, the while loop comes out and the while loop continues to follow the next statement immediately after the body
Special Thanks to:
@cryptokraze
@siz-official
@vvarishayy
@suboohi
@qasimwaqar
This is indeed a great tutorials of Computer software. I wish I get frequent tutorial to enrich my computer skills.
Pls try to DM on oppongk#0087 on Discord.
I tried reaching you but the code you gave me doesn't pick.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Ok I will give you again and contact on discord also. Can we contact on whats app?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit