Learn Programming Technique C to Master Skills - Multiple Selection Program

  • 2 days ago
Transcript
00:00Hello everyone. I'm Sandeep. I'm Sandeep Thakur. In the last video, I explained about the multiple
00:08selection. I have explained the program in the flowchart that you have to input the average
00:14marks and according to the average marks, you have to display the grid. So I explained
00:20this program in flowchart. Now I'm going to make it in C. Let us see how to do it.
00:29I will quickly go and open empty file. Save it also in the name of ARGNU5. You can give
00:47any name to it and save. I started with the hash include. I will use what int main and
01:01inside it. Here I will use what float avg. I gave a message that is what inputAverageMarks.
01:16Then I'm going to use what scanf with type specifier %f where the value is going to store
01:27inside the avg. According to question, I will start using the statement if avg greater than
01:37equals to what 90, isn't it? It's between 80 to 100. So greater than equals to what 80.
01:54In that case, what it should display printf slash and what the question says that you have
02:05to display honors. It should display what here? Honors. At the end what semicolon.
02:24If the condition get false, so it will come to the else part. Again the condition is going to
02:29check if avg greater than equals to what the question says. Let us see if it's
02:37greater than 60 but less than 80. In that case false division.
02:45So here greater than 60 or equal to 60 and less than 80. In that case,
03:00what first division. If here also the condition get false, so it will come to the else part.
03:12If avg greater than equals to I hope so it's 50. Let us see.
03:19Yes, 50 if it's between 50 to 59 and second division.
03:29So I will use what printf slash and second division like this and if again come to what I
03:42will say if avg greater than equals to 40. In that case, printf slash and third division.
03:59At the last what else and inside it printf fail. If it's less than 40 then fail.
04:16So I have completed this program. Let us use what I have done zero.
04:22Okay, save it and click on build. Let us see everything is okay or not.
04:37I'm going to run it. Suppose here I use what 93.
04:46There's some problem.
04:52Let me see what's the problem. I haven't used the ampersand side with the avg.
04:59That's why let me save it and click on build and run it or let me
05:10input the value. So it's shown me what honors and suppose here I input the value what 77
05:21which is between 60 and 80. So what it should display positive vision. I'm putting the values
05:30according to the question and if here I input what 23 which is very less so it should show me what
05:37fail. So the value which I am going to input that is going to store inside the avg if I input was
05:4688. So here the condition gets true. So it's going to display this part. If I input 77
05:53inside the avg. So here the condition will get false as the 77 greater than 80 the condition
06:01get false. So it will come to the else part. It will again take decision here 77 greater than 60
06:09so this part is going to work. I hope you understand how the program works.
06:18I have written the program and how the conditions are checking
06:22and how it's checked and gave us the result. Thanks.

Recommended