Skip to player
Skip to main content
Search
Connect
Watch fullscreen
Like
Bookmark
Share
More
Add to Playlist
Report
Learn Programming Technique C to Master Skills - Continuous If Statement Program
Tutorials Arena
Follow
1 year ago
Category
📚
Learning
Transcript
Display full video transcript
00:00
Hello friends, in the last video I have explained Continuous IF program in flowchart and the
00:09
same program I am going to implement.
00:13
Let us see what was the program.
00:14
This was the program and the program was that a bank introduced incentive policy of giving
00:23
bonus to all its account holders irrespective of their balances.
00:28
Balance amount is greater than equals to 10,000 gender is what male in that case 5% balance
00:33
greater than equals to 10,000 female in that case 10% and if less than 10,000 the amount
00:41
is and whatever the gender either it's male or female then bank is not going to give any
00:49
bonus.
00:50
So no bonus.
00:51
Okay.
00:52
So I have explained it in flowchart in my last video.
00:55
Today I am going to implement in C. Let us see how first of all include stdio.h okay
01:07
and then int main okay so I am going to save it first file then save I will give a name
01:20
to it prg.quantif okay now let us think about the variables which I have to take that is
01:34
float for total balance tb for the amount a what else I have to take okay and then char
01:46
g for the gender okay and here as I have to calculate the bonus also so b for the bonus
01:52
okay.
01:53
Now what I have to input that I am going to display here enter amount and gender okay
02:10
so I have to input the amount and the gender so I will use scanf first of all printf and
02:17
then print s okay here I will use what and a and here what and g for the gender okay
02:29
now if amount is greater than equals to what 10,000 okay and then I will use the brackets
02:41
and again I will take the decision if g equal equals to in a single quote what m okay so
02:51
if this both the condition gets true so as the question says what the question says greater
02:58
than equals to 10,000 gender is male and 5% calculation okay we are going to calculate 5%
03:06
so how that is b equals to a into 5 upon 100 okay so we will get the bonus and then tb equals to a
03:19
plus b okay so the total balance now let us display both the things first of all what slash
03:26
n bonus is that is percent d sorry percent f and then what comma where it is inside b okay
03:38
then what printf total balance is percent f close over noted comma okay and then what comma
04:01
and where it is inside tb okay so if the amount is greater than 10,000 and if the gender is male
04:12
in that case the 5% is going to calculate the bonus amount will be what 5% otherwise it will
04:20
come to the else part again if a greater than equals to 10,000 so this will not be the condition
04:30
will check first if suppose here if the grade is equal equal to m and if the condition get false
04:39
of what gender that if gender is not equal equal to m okay if this condition get false will come
04:49
to the what else part and if gender equal equals to f as for the f for the female okay so this
04:57
condition going to check in that case the bonus which the bank is going to give that is 10% okay
05:06
on the amount and then total balance equal to a plus b the amount and the bonus okay then we have
05:17
to print both the things okay bonus is percent f where it is inside b and then what printf slash n
05:33
total balance is percent f okay comma tb now suppose if this condition also get false
05:51
here the condition becomes true but here the condition get false so it will come to the else
06:00
part of the second if statement but here also this is statement get false okay once it's check
06:08
g equal equal to f it gets false it means you have input the wrong grade for this if okay
06:17
here we will be having what else part and inside it display what printf slash n wrong grade okay
06:28
it's going to end here now this if statement this one okay it's going to this is going to
06:44
close here okay so when the first condition the initial condition this one gets false okay for
06:55
that if the amount is less than 10,000 in that case what will happen it will come to this part
07:04
and what we have to do then if the amount is not greater than 10,000 it's less than 10,000
07:18
so simply what we will do in the else of the first statement we have to display that is what printf
07:24
that is no bonus okay so the employee is not going to get any bonus okay this is the program
07:39
friends and here I should write down for the exit status what return zero okay and save it so let
07:53
us click on build so it's zero error let me run it suppose I input for 20,000 okay and grade m
08:05
so what it should display it should display the bonus 1,000 so the total balance is what 21,000
08:13
okay again if I run it with amount 20,000 and the gender what f for the female in this case
08:27
the one is to will calculate 10% that is 2,000 the total balance will be what amount plus bonus
08:35
20,000 plus 2,000 or 22,000 okay I will check each and every condition suppose 20,000 and I
08:47
have input what k the wrong grade so it should display what wrong grade should notice I should
08:53
have written here what wrong gender sorry so what should display wrong gender when I display it
09:03
okay when I input 20,000 and what k so wrong gender so it should display what wrong gender
09:10
okay and if I again run the program with a small amount that is 500 with m that is male
09:24
in that case it's going to display what no bonus okay so I have checked each and every
09:30
condition let us see if suppose I haven't put 20,000 and gender m so these two condition get
09:42
true okay as the amount is 20,000 the gender is what m for the male these two conditions get true
09:49
so this statement is going to work it's going to calculate the bonus and the total balance
09:56
now if I run the program one more time this time 20,000 greater than 10,000 suppose I input
10:02
20,000 for the amount and for the gender what f so here the condition will get true
10:08
but here the condition will get false for the second if okay it will come to the else part
10:14
again it's going to check if it's inside g it's f f equal equal to f if the condition is true
10:20
so according to the question 10 percent of bonus is going to calculate total amount is going to
10:26
calculate and then it's going to display the total amount or you can say the total balance
10:31
that is bonus plus amount okay amount of the account holder and the bonus that will be added
10:38
and it's going to display what total balance now if you are going to input a wrong rate so what
10:45
will happen the first condition is going to true as it's 20,000 greater than 10,000 but you haven't
10:50
put a wrong rate that is k so here the conditional get false it will come to the else part here also
10:56
the conditional get false so in that case it's going to display what wrong gender okay and if
11:04
I input here only what 5,000 and suppose here I input what m for the male so here the conditional
11:13
get false here also the conditional get false and both the cases conditional get false
11:18
so for this first if which is going to add at the right here at this place
11:27
this okay after here the else part is here okay and it will show what no bonus
11:37
I hope you understand the concept how to use the if statement okay and
11:49
continuously how to apply the if statement and do the calculation work and we'll get the result
11:56
this is the program friends I hope you understand
11:58
the next video I'm going to explain something else bye
Be the first to comment
Add your comment
Recommended
7:56
|
Up next
Learn Programming Technique C to Master Skills - Nested If Statement Program
Tutorials Arena
1 year ago
10:56
Learn Programming Technique C to Master Skills - Loop With If Statement Program
Tutorials Arena
1 year ago
5:14
Learn Programming Technique C to Master Skills - Single If Statement Program Explanation
Tutorials Arena
1 year ago
8:07
Learn Programming Technique C to Master Skills - Loop with if Statement Second Program
Tutorials Arena
1 year ago
8:32
Learn Programming Technique C to Master Skills - If .... else if Statement Program
Tutorials Arena
1 year ago
5:29
Learn Programming Technique C to Master Skills - Continuous If Program (Flow Chart)
Tutorials Arena
1 year ago
9:20
Learn Programming Technique C to Master Skills - Union Program
Tutorials Arena
1 year ago
12:25
Learn Programming Technique C to Master Skills - Call By Reference Program
Tutorials Arena
1 year ago
4:57
Learn Programming Technique C to Master Skills - Loop With If Statement Program ( Flow Chart )
Tutorials Arena
1 year ago
5:02
Learn Programming Technique C to Master Skills - Third Program of Loop
Tutorials Arena
1 year ago
2:58
Learn Programming Technique C to Master Skills - Nested If Statement Program (Flow Chart)
Tutorials Arena
1 year ago
9:12
Learn Programming Technique C to Master Skills - Program of Recursion
Tutorials Arena
1 year ago
4:54
Learn Programming Technique C to Master Skills - Single If Statement Program (Flow Chart)
Tutorials Arena
1 year ago
8:01
Learn Programming Technique C to Master Skills - Loop Within Loop Program
Tutorials Arena
1 year ago
8:08
Learn Programming Technique C to Master Skills - First Program of Function
Tutorials Arena
1 year ago
4:57
Learn Programming Technique C to Master Skills - Loop with If Statement Second Program Continue...
Tutorials Arena
1 year ago
10:48
Learn Programming Technique C to Master Skills - Eighth Program of Function
Tutorials Arena
1 year ago
11:15
Learn Programming Technique C to Master Skills - Third Program of Function
Tutorials Arena
1 year ago
10:48
Learn Programming Technique C to Master Skills - Structure and Functions Program
Tutorials Arena
1 year ago
5:27
Learn Programming Technique C to Master Skills - Sixth Program of Function
Tutorials Arena
1 year ago
6:33
Learn Programming Technique C to Master Skills - Multiple Selection Program
Tutorials Arena
1 year ago
4:14
Learn Programming Technique C to Master Skills - Explanation of Second Program
Tutorials Arena
1 year ago
4:22
Learn Programming Technique C to Master Skills - Pointer And Arrays Program
Tutorials Arena
1 year ago
9:09
Learn Programming Technique C to Master Skills - Second Program( Call by Reference)
Tutorials Arena
1 year ago
8:22
Windows debug - Introduction
Tutorials Arena
1 year ago
Be the first to comment