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 - Second Program of Loop (While Loop)
Tutorials Arena
Follow
10/17/2024
Category
š
Learning
Transcript
Display full video transcript
00:00
Hi, in the last video I have explained about how to display the first three odd numbers,
00:11
how to display the square of first three odd numbers i.e. 1, 9 and 25.
00:16
I have explained this program in the flowchart in the last video.
00:20
Now today I am going to make the program in C.
00:23
So let us see how to do it.
00:34
I will open the new file that is cache include inside it what stdio.h and what int main and
00:47
inside it I will take the variables.
00:50
Before taking it, before taking the variables let us save it, let us say loop 2, 1, b, something
01:03
like this I have given the name to it and save.
01:08
I need the variables that is od, then sq, then i.
01:16
I will initialize the value of od that is 1.
01:19
I will initialize the value of i that is 1.
01:25
Now I will apply the while loop while i less than equals to 3.
01:32
How many times the loop is going to work for the 3 times that's why I apply i less than
01:37
equals to 3.
01:38
First thing what I will do, I will do the square of odd number that is od equals to
01:43
od, then I will print the resulted value that is slash n square of odd number is that
01:59
is where it is inside sq, then I will use od equals to od plus 2 and then i equals to
02:13
i plus 1.
02:16
This loop is going to carry on for 3 times and we are going to get the result and I am
02:22
going to use what I have written 0, then I will save it.
02:29
Let me click on build as there is zero error, let us run the program, so it's displayed
02:38
1, 9 and 25, I quickly understand it, the value of i it is 1, 1 less than 3 the condition
02:47
is true, 1 into 1 what is inside sq it is 1, so 1 is going to print and 1 plus 2 it
02:56
is what 3, so inside od it is 3, 1 plus 1 it is 2, what is inside i it is 2, the loop
03:04
will carry on 2 less than 3, the condition is true, what is inside od it is 3, so 3 into
03:12
3, now the value inside sq will be 9, so 9 is going to print and what 3 plus 2 5 and
03:23
2 plus 1 3, again the loop will carry on as value of i is 3, 3 equal to 3 condition is
03:30
true, what inside od it is 5, so 5 into 5 25, inside sq it will store the resulted value
03:40
inside sq and then it's going to display that is 25, then 5 plus 2 7 and here 3 plus 1 4,
03:50
4 less than 3 condition false and this loop is going to terminate, but we will get the
03:57
square of first 3 odd number it is 1, 9 and then 25.
Recommended
4:03
|
Up next
Learn Programming Technique C to Master Skills - Second Program of Loop ( For Loop )
Tutorials Arena
10/17/2024
3:55
Learn Programming Technique C to Master Skills - First Program of Loop (While Loop)
Tutorials Arena
10/13/2024
3:51
Learn Programming Technique C to Master Skills - First 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
4:28
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( For Loop )
Tutorials Arena
10/13/2024
8:01
Learn Programming Technique C to Master Skills - Loop Within Loop Program
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
3:52
Learn Programming Technique C to Master Skills - Second Program of Loop (Flow Chart)
Tutorials Arena
10/17/2024
10:56
Learn Programming Technique C to Master Skills - Loop With If Statement Program
Tutorials Arena
10/13/2024
4:57
Learn Programming Technique C to Master Skills - Loop With If Statement Program ( Flow Chart )
Tutorials Arena
10/13/2024
5:02
Learn Programming Technique C to Master Skills - Third Program of Loop
Tutorials Arena
10/17/2024
3:27
Learn Programming Technique C to Master Skills - Third Program of Loop ( Flow Chart)
Tutorials Arena
10/17/2024
3:51
Learn Programming Technique C to Master Skills - First Program of Loop (Flowchart)
Tutorials Arena
10/13/2024
4:57
Learn Programming Technique C to Master Skills - Loop with If Statement Second Program Continue...
Tutorials Arena
10/17/2024
4:01
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( Flow Chart )
Tutorials Arena
10/13/2024
7:02
Learn Programming Technique C to Master Skills - Sixth Program of Array (Loop with if)
Tutorials Arena
11/1/2024
8:18
Learn Programming Technique C to Master Skills - Loop Within Loop Program Explanation in Flow chart
Tutorials Arena
10/17/2024
9:09
Learn Programming Technique C to Master Skills - Second Program( Call by Reference)
Tutorials Arena
11/8/2024
2:34
Learn Programming Technique C to MasterĀ Skills - Second Program of Function ( Return Val) - I
Tutorials Arena
11/3/2024
4:19
Learn Programming Technique C to Master Skills - Loop Within Loop Explanation with Real Time Example
Tutorials Arena
10/17/2024
6:03
Learn Programming Technique C to Master Skills - Linked List ( Second Program)
Tutorials Arena
11/30/2024
12:06
Learn Programming Technique C to Master Skills - Continuous If Statement Program
Tutorials Arena
10/8/2024
11:41
Learn Programming Technique C to Master Skills - Second Program of Array
Tutorials Arena
11/1/2024
3:16
Learn Programming Technique C to MasterĀ Skills - First Program of Function ( Continue ...)
Tutorials Arena
11/3/2024
5:59
Learn Programming Technique C to Master Skills - File Handling Second Program (Continue..)
Tutorials Arena
11/18/2024