Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Comments
Bookmark
Share
Add to Playlist
Report
Learn Programming Technique C to Master Skills - First Program of Loop (While Loop)
Tutorials Arena
Follow
10/13/2024
Category
š
Learning
Transcript
Display full video transcript
00:00
Hello everyone, in my last video I have explained the flowchart of display first three odd numbers.
00:12
I have explained with a dry run that how we will get the first three odd numbers.
00:18
Now I'm going to implement this program in C, so I'm going to open a new file.
00:29
One empty file, I will save it also, then hash include what strdio.h, I will use what
00:56
main, first of all I'm going to make the program in while loop and then I'm going to make the
01:04
same program in for loop. I need the variables for odd number od to count the number of odd
01:14
numbers that is i, I will define the value odd number that is 1 and I will initialize the value
01:22
of i also that is 1. Now I will apply the loop while i less than equal to 3 as the loop is going
01:33
to carry on for three times. First of all I will use the printf and what slash n odd a number is
01:44
%d where it is, it is inside od, so it's going to display and od equals to od plus 2, so we are
01:56
going to get the next odd number and i equals to i plus 1, so we are going to get the next
02:05
incrementation in the counter variable.
02:08
So this is the program friends, let me save it by using ctrl s and click on the build and see
02:18
if there is any error or not, so it's showing zero error and I'm going to run it, so it displayed 1,
02:27
3 and 5. Now let us quickly understand how the things work, I've taken two variables,
02:33
the first odd number is 1 as going to count with the counter variable i, so the value of i is also
02:39
1, while the value of i is less than 3, so yes here 1 is less than 3, the condition is true,
02:49
so it's going to print the first odd number that is odd number is 1, then 1 plus 2 that is what 3,
02:57
here 1 plus 1 that is what 2, it will come to the while loop, 2 less than 3 condition is true,
03:05
so the next value which is there inside od that is what 3 that is going to print,
03:10
then 3 plus 2 that is what 5, so remember the value of od it is what 5,
03:17
2 plus 1 what is now another value of i, it's 3, again it will go to the while loop,
03:22
3 equals to 3 the condition is true, what was the last value inside od it was 5,
03:28
so it's going to display and 5 plus 2, 7 here it will be what 3 plus 1, 4
03:36
come to the while loop, 4 less than 3 the condition is false, so the loop will terminate
03:43
and we will get the results that is 1, 3 and 5. So I hope you understand, in the next video
03:50
we will see some another program of loop. Bye.
Recommended
3:51
|
Up next
Learn Programming Technique C to Master Skills - First Program of Loop (For Loop)
Tutorials Arena
10/13/2024
4:07
Learn Programming Technique C to Master Skills - Second Program of Loop (While Loop)
Tutorials Arena
10/17/2024
4:03
Learn Programming Technique C to Master Skills - Second Program of Loop ( For Loop )
Tutorials Arena
10/17/2024
4:28
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( For Loop )
Tutorials Arena
10/13/2024
5:33
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( While Loop )
Tutorials Arena
10/13/2024
8:01
Learn Programming Technique C to Master Skills - Loop Within Loop Program
Tutorials Arena
10/17/2024
3:51
Learn Programming Technique C to Master Skills - First Program of Loop (Flowchart)
Tutorials Arena
10/13/2024
10:56
Learn Programming Technique C to Master Skills - Loop With If Statement Program
Tutorials Arena
10/13/2024
3:52
Learn Programming Technique C to Master Skills - Second Program of Loop (Flow Chart)
Tutorials Arena
10/17/2024
8:07
Learn Programming Technique C to Master Skills - Loop with if Statement Second Program
Tutorials Arena
10/17/2024
5:02
Learn Programming Technique C to Master Skills - Third Program of Loop
Tutorials Arena
10/17/2024
4:57
Learn Programming Technique C to Master Skills - Loop With If Statement Program ( Flow Chart )
Tutorials Arena
10/13/2024
3:27
Learn Programming Technique C to Master Skills - Third Program of Loop ( Flow Chart)
Tutorials Arena
10/17/2024
7:02
Learn Programming Technique C to Master Skills - Sixth Program of Array (Loop with if)
Tutorials Arena
11/1/2024
4:01
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( Flow Chart )
Tutorials Arena
10/13/2024
8:18
Learn Programming Technique C to Master Skills - Loop Within Loop Program Explanation in Flow chart
Tutorials Arena
10/17/2024
4:57
Learn Programming Technique C to Master Skills - Loop with If Statement Second Program Continue...
Tutorials Arena
10/17/2024
3:16
Learn Programming Technique C to MasterĀ Skills - First Program of Function ( Continue ...)
Tutorials Arena
11/3/2024
8:06
Learn Programming Technique C to Master Skills - Linked List ( First Program)
Tutorials Arena
11/30/2024
12:06
Learn Programming Technique C to Master Skills - Continuous If Statement Program
Tutorials Arena
10/8/2024
12:26
Learn Programming Technique C to Master Skills - First Program of Array
Tutorials Arena
10/20/2024
6:04
Learn Programming Technique C to Master Skills - First Program (Array with Function , Call by Value)
Tutorials Arena
11/9/2024
7:12
Learn Programming Technique C to Master Skills - Third Program (Passing Entire Array in Function)
Tutorials Arena
11/9/2024
9:09
Learn Programming Technique C to Master Skills - Second Program( Call by Reference)
Tutorials Arena
11/8/2024
6:03
Learn Programming Technique C to Master Skills - Linked List ( Second Program)
Tutorials Arena
11/30/2024