Skip to player
Skip to main content
Skip to footer
Search
Connect
Watch fullscreen
Like
Bookmark
Share
Add to Playlist
Report
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( For Loop )
Tutorials Arena
Follow
10/13/2024
Category
š
Learning
Transcript
Display full video transcript
00:00
Hi, I'm Sandeep. I'm going to make the program of display of odd numbers user
00:09
choice with the help of for loop. Okay, let us see how to make it. I will open
00:22
an empty file and then I'll go to file and save file to save it, prg user for
00:36
then I will start making the program that is hash include, hash study io.h
00:43
standard input output file I have included then int main, inside it I will
00:50
take what int od for the odd number and for the number of times the loop is
00:58
going to carry on and then what i and od I have given the value 1 okay and here I
01:06
will give a message first of all that is what input term that how many times you
01:13
are going to carry on the loop okay. I will use what is scanf inside it
01:20
%d,&% or you can say and n so the loop is going to carry on to the
01:29
value which we give inside the n okay. I will use the for loop for i equals to 1
01:36
i is going to compared with n then what i plus plus like this. First thing printf
01:47
what I will display the odd number okay slash n odd number is %d,&%
02:00
inside od and what od equals to od plus 2 okay and I will use what return 0
02:10
statement okay. Now click on the build it's showing me the error why I haven't
02:19
used here semicolon at the end so I will use it again save the program by using
02:25
ctrl s click on build and now it's showing what 0 error okay. So this is the
02:32
program friends let us run and see let me give the term suppose to so only is
02:41
going to work for two times so it will display the first two odd numbers 1 and
02:46
3. If I again run it and if I give here 5 so it's going to display 5 odd
02:54
numbers that is 1 3 5 7 and 9. So quickly understand it I have taken 3
03:01
variables od n and i the value of od that is what 1 okay. I will put the term
03:09
suppose I will put 2 so how many times this loop is going to work for 2 times
03:14
the value of i is 1, 1 less than 2 as the value inside n is 2 so the first odd
03:21
number is going to work okay to print okay that is what 1 and 1 plus 2 it is
03:28
3 inside od it is what 3 it will come to the increment part now the value of i
03:34
will be what from 1 to what 2 it will come to the decision part 2 equal to 2
03:40
yes the condition is true what is the next value inside the od it is 3 so it's
03:47
going to print what 3 then 3 plus 2 5 inside od okay new value inside od it is
03:55
what 5 it will come to the increment part of i or the new value of i is what
04:00
3, 3 less than 2 as the value inside n is 2 so 3 less than 2 the condition
04:07
will get false this loop will terminate okay and we'll get the two odd numbers
04:13
that is 1 and 3 so the value which we are inputting inside n that much time
04:21
this for loop is going to work okay and we'll get the odd numbers
Recommended
5:33
|
Up next
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( While Loop )
Tutorials Arena
10/13/2024
4:03
Learn Programming Technique C to Master Skills - Second Program of Loop ( For Loop )
Tutorials Arena
10/17/2024
3:51
Learn Programming Technique C to Master Skills - First Program of Loop (For Loop)
Tutorials Arena
10/13/2024
3:55
Learn Programming Technique C to Master Skills - First Program of Loop (While 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:01
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( Flow Chart )
Tutorials Arena
10/13/2024
8:01
Learn Programming Technique C to Master Skills - Loop Within Loop Program
Tutorials Arena
10/17/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
4:57
Learn Programming Technique C to Master Skills - Loop With If Statement Program ( Flow Chart )
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
3:51
Learn Programming Technique C to Master Skills - First Program of Loop (Flowchart)
Tutorials Arena
10/13/2024
9:14
Learn Programming Technique C to Master Skills - Fourth Program (Call by Reference)
Tutorials Arena
11/8/2024
7:02
Learn Programming Technique C to Master Skills - Sixth Program of Array (Loop with if)
Tutorials Arena
11/1/2024
10:56
Learn Programming Technique C to Master Skills - Loop With If Statement Program
Tutorials Arena
10/13/2024
8:07
Learn Programming Technique C to Master Skills - Loop with if Statement Second Program
Tutorials Arena
10/17/2024
6:52
Learn Programming Technique C to Master Skills - Fourth Program - (Call by Reference - continue..)
Tutorials Arena
11/8/2024
12:37
Learn Programming Technique C to Master Skills - Fourth Program of Array
Tutorials Arena
10/20/2024
9:40
Learn Programming Technique C to Master Skills - Fifth Program of Array
Tutorials Arena
10/20/2024
7:35
Learn Programming Technique C to MasterĀ Skills - Fourth Program of Function
Tutorials Arena
11/3/2024
5:02
Learn Programming Technique C to Master SkillsCharacter String Fourth Program (Flowchart)
Tutorials Arena
11/19/2024
4:54
Learn Programming Technique C to Master SkillsCharacter String Fifth Program ( Flowchart)
Tutorials Arena
11/19/2024
8:18
Learn Programming Technique C to Master Skills - Loop Within Loop Program Explanation in Flow chart
Tutorials Arena
10/17/2024
7:30
Learn Programming Technique C to MasterĀ Skills - Fifth Program of Function
Tutorials Arena
11/3/2024
7:10
Learn Programming Technique C to Master SkillsCharacter String Fourth Program
Tutorials Arena
11/19/2024