Learn Programming Technique C to Master Skills - Continuous If Program (Flow Chart)

  • last week
Transcript
00:00Hello everyone, this is Sandeep. Today I am going to start Continuously Statement program.
00:08In Continuously Statement, we have to take decision continuously. So this is the program.
00:18Bank introduce incentive policy of giving bonus to all its account holders irrespective
00:25of their balances. If the account holder balance is greater than equals to 10,000 and
00:33account holder is male, then in that case, account holder will get 5% bonus on the account
00:41which he is having in his account. If the balance amount is greater than equals to 10,000
00:51but the account holder is female, in that case, the bank policy is to give 10% bonus
01:01on whatever the account she is having in its account. And if the balance amount is less
01:08than 10,000, either the account holder is male or account holder is female, bank is
01:18not going to give any bonus. So you have to calculate the bonus and the total balance
01:23and then you have to display. For total balance, the variable is for tb, for the amount which
01:29the account holder will having in its account, for that is a. For gender, we have taken g
01:39and for bonus b. So when I input the amount and the gender, it is going to check both
01:47the things, the amount which the account holder is having and the gender. If both the
01:53condition is true, then according to question 5%, if gender is not male, it will come to
02:00the no part and it is going to check if it is female. Then if it is female, according
02:05to question 10% bonus, going to calculate and then total balance is going to calculate
02:12and then going to display. Let us do the try run and understand. Suppose the amount
02:20which the account holder is having that is 20,000 and the gender is male, for male is
02:29the code m. So here if 20,000 greater than 10,000 years, the condition is true, it will
02:35come to the yes part. Inside g, it is m, m equal to m. Inside the g variable, the value
02:44is what m. So m is compared with the constant m. Yes, the condition is true. Both the conditions
02:50are true. So in that case, according to question 5% bonus calculated, total amount is calculated.
03:00So the bonus is first calculated. So the bonus amount is 1,000 and then total amount
03:06will be 20,000 plus 1,000 that is 21,000. Let us run one more time the program. If the
03:16amount is 20,000 but the gender is f. So here the condition is true, but here the conditional
03:24get false. As inside g, it is f, f equal to m. Here the condition is false, it will
03:32come to the no part. If what is inside g, it is f, f equal to f. Yes, here the condition
03:38is true. So the gender is female. In that case, bank is going to give 10% bonus. So
03:47on amount, the 10% bonus is calculated. That is 20,000 plus 2,000 that will be the total
03:59balance. That is 22,000. Both the things going to display the total balance and the bonus
04:06and then stop. Let us run one more time. Suppose the amount is 20,000 but we have input a wrong
04:16gender, suppose k. So here the condition is true, 20,000 greater than 10,000, but here
04:22the conditional get false, k equal to m and it will come to no part. If k equal to f,
04:29here also the conditional will get false, it will come to the no part and what it is
04:34going to display? Wrong gender. We have input the wrong gender. They are only what m and
04:38f, male and female. For male, it is m and for female what f, but here we have input
04:45wrong gender. In that case, it is going to display wrong gender and then stop.
04:51One more time, we will run it. Suppose the amount is 5,000 in the account and the gender is what
04:59male. So at the initial state, the conditional will get false as inside a it is 5,000 greater
05:05than 10,000, the condition false. It will come to the no part and according to the question,
05:12no bonus. So it is going to display what? No bonus and then stop.
05:16So with the help of flowchart, I hope you understand how to apply the
05:20continuous if. In the next video, I am going to implement the same program in C. Thank you.

Recommended