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 - Loop With If Statement Program ( Flow Chart )
Tutorials Arena
Follow
10/13/2024
Category
📚
Learning
Transcript
Display full video transcript
00:00
Hello everyone, I am Sandeep Thakur.
00:06
Now today I am going to start loop with if statement.
00:10
Earlier what we have studied, we have studied if statement separately and we have studied
00:17
loop separately.
00:18
Now I am going to combine both the things loop and if statement.
00:24
So how are the programs of loop with statement that I am going to explain.
00:29
Let us first understand in the flowchart then I am going to implement in C.
00:35
So this is the program friends, input numbers from keyboard and count total even numbers
00:41
and total odd numbers.
00:44
So this is also a user choice program as I haven't mentioned that how many numbers I
00:48
have to input from the keyboard.
00:51
The numbers of which I am going to input those numbers can be odd or can be even.
00:59
For that we have to check.
01:02
Now how many numbers we have to input for that we have to apply loop and for checking
01:08
also we have to input a particular number, is it odd or is it even.
01:15
For that I have taken the variables, how many times the loop will carry on for that I have
01:20
taken the variable n, which number we have to input I have taken for that num to see
01:27
is it odd or even for that ev and odd.
01:31
So we have to count the total odd numbers and total even numbers for the counting of
01:36
even numbers I have taken ev for counting of odd numbers I have taken odd and to carry
01:41
on loop I have taken the counter variable i.
01:46
I have defined the values or I can say I have initialized the value of ev that is what 0
01:51
of od 0 and i equals to 1.
01:56
Now I am going to input the term or you can say the value of n, I input the value of n3
02:04
so how many times this loop is going to carry on, this loop is going to carry on for 3 times.
02:11
This outer decision box represents to the loop and this one represents to the if statement.
02:22
So what is value of i, it is 1, 1 less than 3, yes 1 less than 3 the condition is true
02:28
it will come to the yes part.
02:30
I am going to input the first number, suppose I input what 60.
02:35
So it is going to check 60, I have used the module operator module by 2 and it will divide
02:44
if it is going to give the remainder what 0 that's mean it is what even number and
02:53
it is going to count.
02:54
So 0 plus 1 that is equal to 1 and it is going to also count the counter variable as we have
03:02
to carry on the loop so 1 plus 1 that is what 2.
03:05
So the value of i is what 2, so the loop will carry on 2 less than 3 the condition is true
03:13
the next number which I am going to input that is what 5.
03:19
Again I will module it by 2 so obviously it is going to give the remainder so this condition
03:26
will get false it will come to the no part it is going to count that 5 is the odd number
03:32
so that is what 0 plus 1 equals to 1 so it is counted the odd number.
03:40
We have input two numbers from that is 60 and 5 it counted the first number is what
03:45
even and the second number 5 is what odd and if you see it is also connected with the counter
03:51
variable so 2 plus 1 now the value of i is what 3.
03:55
So the value of i is 3, 3 equal to 3 the condition is true.
04:01
The next value is going to input that is what 10, 10 is moduled by 2 obviously the remainder
04:06
will be what 0 so 0 equal to 0 so it is even number so it will come to the yes part.
04:14
What is the value of ev it is 1, 1 is going to add so it is what 2.
04:20
So it is count the odd number the even number it is counted the even number then it is connected
04:27
with the counter variable so what is the value of i it is 3, 3 plus 1 4 again it is going
04:34
to this loop 4 less than 3 now the condition get false so it is going to print the number
04:42
of even numbers and the odd numbers.
04:47
So it printed that even number is 2 and the odd number is 1.
04:52
Thanks for watching this video in the next video I am going to make the program.
Recommended
2:58
|
Up next
Learn Programming Technique C to Master Skills - Nested If Statement Program (Flow Chart)
Tutorials Arena
10/12/2024
4:54
Learn Programming Technique C to Master Skills - Single If Statement Program (Flow Chart)
Tutorials Arena
10/12/2024
3:27
Learn Programming Technique C to Master Skills - Third Program of Loop ( Flow Chart)
Tutorials Arena
10/17/2024
5:29
Learn Programming Technique C to Master Skills - Continuous If Program (Flow Chart)
Tutorials Arena
10/8/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:01
Learn Programming Technique C to Master Skills - Fourth Program of Loop ( Flow Chart )
Tutorials Arena
10/13/2024
3:51
Learn Programming Technique C to Master Skills - First Program of Loop (Flowchart)
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
12:06
Learn Programming Technique C to Master Skills - Continuous If Statement Program
Tutorials Arena
10/8/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
8:01
Learn Programming Technique C to Master Skills - Loop Within Loop Program
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
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
8:07
Learn Programming Technique C to Master Skills - Loop with if Statement Second Program
Tutorials Arena
10/17/2024
4:07
Learn Programming Technique C to Master Skills - Second Program of Loop (While Loop)
Tutorials Arena
10/17/2024
7:56
Learn Programming Technique C to Master Skills - Nested If Statement Program
Tutorials Arena
10/12/2024
4:39
Learn Programming Technique C to Master Skills - If... else if Statement Program (Flowchart)
Tutorials Arena
10/8/2024
5:14
Learn Programming Technique C to Master Skills - Single If Statement Program Explanation
Tutorials Arena
10/12/2024
4:55
Learn Programming Technique C to Master SkillsCharacter String Second Program (Flowchart)
Tutorials Arena
11/19/2024
3:20
Learn Programming Technique C to Master Skills - Multiple Selection Program (Flow chart)
Tutorials Arena
10/12/2024
5:02
Learn Programming Technique C to Master Skills - Third Program of Loop
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