 Hello friends, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. So, as you know, this is the second lecture of the C language video series which I am preparing in Hindi. So, in this lecture, I will tell you some programs that you are familiar with. This is basically how we implement C compilers. And while implementing those programs, I will tell you the comments. First, we will explore the detail of the print efforts. So, before we start, we will go through the topics covered in the lecture 1. In the lecture 1, I told you what C is and what features we use. Then we discussed what are the constant variables and keywords. And I told you how to implement a sample C program. By using the software of C programming, we implement a problem and solve it. So, in the first video, we only saw the introductory part. To understand the introduction part and the depth part, this is the lecture number 2. And if you are watching the lecture number 2 video and you want to follow the whole playlist or the whole series, I have put the playlist link in the description of this video. So, if you open that link, you will get all the lectures automatically arranged. And along with that, I have added the playlist link of the videos made in English. So, you can also follow them. And in this lecture, we are going to discuss the programs. So, first of all, we will discuss that if we have to calculate a simple interest which we have done in the match, if we have to implement it in C programming, then how will it be? And this is my information. If you want to take online classes or if you want to discuss it now, then you can contact me on this information or you can comment in the video. So, let's start the first program. So, as I told in my first video that to implement programs, the compiler we are using is Dev C++. If you want to use any other compiler like Turbo C, then you can do that too. If you want to use a code block, then you can do that too. The coding is the same. Your environments will be different. So, you can easily implement whatever environment you have available to you. So, as I told you, we will discuss two more things in detail. Comment and printf and scanf. So, the first thing I am writing is calculate simple interest. For this, I have used forward slash and star. And lastly, I have used star and forward slash. So, basically, we call this comment. So, what is comment work? Many times, you will need a code that you want to write in your own language. So, the compiler runs on syntax. And the syntax is already defined. It means that it is not possible to write anything on your own. But you want it to be possible. So, it will be possible through the comment. So, this is the first line I have written. Accordingly, it is not following any syntax. But it will not show any error. Because I have written forward slash and star in the middle of forward slash. So, this is the comment. So, basically, whenever you want to write something in the code for understanding, and you do not want to execute it, then you implement it through the comment. So, in other examples, we will use the comment in many places. And stdio.h, this is the header file that I have mentioned in the previous video. Whenever you want to use printf, scanf, or any pre-defined function, then there will be no header file related to the pre-defined function. So, we are using stdio.h, which is necessary for printf and scanf. So, when you use printf scanf, then you will have to include this header file. And after that, whatever program we will write, we will always write in the main function. So, the main user is defined. You can write anything in your own according to this. But the name of it is fixed. You will always have to use it in the main small letter. And since it is case sensitive, you will have to write it in small. If it was already decided in the capital, then you would have to write it in the capital. Okay. Now, we have to calculate the simple interest. So, we will have to input the principal, rate of interest and time from the user. So, we will have to make some variables for that. So, as I told you in the previous video, if we have to store anything in the program, then we will do it in the variable. And we have to define the data type for the variable. So, the data type that I am going to use is float. Okay. So, in the previous video, I told you to use int. Because we have summed up two numbers. Two numbers are normal integer values. So, we have used int. But right now, we are using float because we have to use the point values. So, for that, I am declaring some variables. So, the first statement that is written is variable declaration. Okay. Again, what I have used is comment. It means, it will not execute. It is just telling you what is the line that we have written. So, how many variables have we made? Four. And what type have we made? Float. This means, if I store 5.2 in e, then it will be stored. If I write int instead of float, if I write int instead of float, and then I store 5.2 in p, then point 2 is not stored. It only stores 5. Whereas, you will know that, when we do any interest calculation, the role of point is very big. So, what we will use in int? Float. After declaring the variable, you will write a printf in which you will write int, principal, rate and time. You can also write the whole thing. So, principal, rate and time, user will input. Then, you will write scanf. Now, how many numbers do we have to read? Three. Principal, rate and time. And three are float type. So, you will have to write %f in scanf. How many times? Three times. Because, we are reading float value. In the last video, I told you that, we are writing %d. Why? Because, the type of variable was integer type. So, you have to keep in mind, whenever you use integer type, when you use int, then you have to write %d in scanf. And when you use float, what you have to use? %f. How many times you have to use it? It depends on how many variables you have to input. So, how many variables you have to input here? Three. So, %f, how many times you have to write? Three times. This. If there were four variables, if there were four %f, if there were two, then there would be two. According to that, you have to write this scanf. Now, I will remove these. Now, we will implement our formula. So, we have to calculate the simple interest. So, what is its formula? We have to multiply the principle, rate and time. And divide it from 100. This is its formula. So, principle, rate and time will be multiplied. It will be divided from 100. The result will be, in which it will be stored? Simple interest variable, SI variable. Now, we have to display that variable on the screen. So, we have to use printf. In that, you will write these messages. And this is completed. So, as I told you in the previous video, I told you to explore printf. Now, we will explore in more detail. So, look here. Backslash n means new line. This is backslash n. This will tell you the new line. And you can call it enter. This means a new line. Means, an enter will be pressed. And then print will be simple interest equals to. This will be print as it is. But, percentf will not be printed. So, you will say that percentf will not be printed. So, why did you use it? So, I used it because, on the place of percentf, the variable named SI will print its value. On the place of percentf, the value in SI variable will be printed. So, whenever you want to print a value in printf, then you will use this percentf or percentd format specifier. And it will not be printed. It will display the value of the variable in its place. Okay? So, you must have understood this. And this is a very simple program. We have inputted three values. Principal, rate and time. Then formulae. We have solved it. We have identified the simple interest. And through printf, we have displayed it on the screen. So, we will save it. Execute it. Compile and run. Compile and run. If there was any error, you would have been displayed below. Otherwise, it would have shown that errors and warnings are zero. Now, I will enter principal. Then, I have added rate of interest to 10 and time to 3. And in front of you, the simple interest has been calculated to 300. So, in this way, if we have to implement any calculation or mathematical problem in C, then what are the steps? So, first of all, all the required variables will be declared. Through printf and scanf, you will get the required values from the user. So, do not think that you have declared four variables. So, you have to input all four. It is possible that you have written some variables for calculation. So, for example, I have got three inputs. Then, with the help of those three, I have written a calculation and I have stored the result in the fourth variable. And finally, through printf, I have displayed it on the screen. So, if we categorize it, these are the three parts. The first part is the input. The second part is the process. And the third part is the output. So, normally, you will have to implement these three phases that you will take some input, then you will apply the process and then you will display it in the form of the output. Now, you must have seen it in the output. For example, if I run it again, then you will see that 300 point and 6 zeros are being printed here. Now, you will want that there are only two points that we can limit. So, what you have to do is you have to write percent point 2f. So, after the point, how many digits will be printed? Two digits. Save it and run it again. So, I am explaining this by exploring printf. I will tell you something like this. Normally, if you watch any other videos, you won't get it. So, I am going to tell you some different things in my video series. So, you can see that 300 point is being printed. If you write point 3f, then after the point, you get three digits. If you write point 4f, then you get four digits. So, in this way, you can customize the float values. Okay? So, you must have understood so much. Now, let's move ahead. So, the next problem is you have to write calculate area and perimeter of rectangle. Again, we have commented so that we can know what we are going to do. Then, the header file will be as it is because you have to use printf scanf normally in your program. Then, the main function is the variable. So, what is the input? length and breadth. And the second variable is breadth. So, the input will be integer or float. Means, the point values will come or without. So, you will say that the length of the point can come. So, again we will use float. And I have made two variables for length and breadth. Now, we have to calculate area and perimeter. So, I have made a for area and perimeter. So, total variable is 4. Do we have to get 4 inputs? No. We have to get only 2 inputs. The first one will be length and the second one will be breadth. So, you have written printf. So, you have written enter length and breadth. Then, you have written scanf. Now, see how many inputs are there? 2. How many were there in the last program? 2 times. Now, I hope that you are getting gradually understood. So, the more programs we will make, the more you will get confidence. So, as soon as you see this video, see one program and you can implement it. After seeing the whole video, I will explain it in 3-4 programs and you will practice it. So, you will see in my whole video series that I will tell you how to implement it. So, this is very beneficial for your learning. And if you have any doubt comment in this video or I have shared my email id and whatsapp number you can contact me and talk to me. So, we have received input. Now, our second phase is process. We have to calculate area and perimeter. Now, if I ask you what is the formula of area and perimeter, you will smile a little and this is very easy. If you want to calculate area, then multiply length for breadth and if you want to calculate perimeter, then 2 into L plus B. So, if this is so simple, you can implement it. So, this is area and this is perimeter. So, as simple as mathematics is, programming is simple. Now, some people are laughing that math is not simple. Math is very simple, if programming is based on maths, then what programming is required is practice. The more you practice, the easier it will be. And if you watch the video, then you will understand that we will not be able to make it. So, after watching the video, you implement the program. If you get stuck, watch the video again. Understand the explanation. Discuss with friends, discuss with me. So that you have as many problems in maths. So, as we solve problems in maths, we solve them here. You have to keep in mind that you have to follow the rules. In maths, we write on the copy pan. So, nothing is executed there. But the software in the computer runs live. If there is any mistake, then you will know. So, you cannot escape from things. You have to follow the proper rules. So, we have calculated area perimeter. Now, the third phase is to print the result. Now, you will get to see the modified form of printf. So, till now, till now, in the previous program, there was one output, simple interest. And the lecture 1, I told you, we did the sample of two numbers. So, there is also one output. Now, the first program has two outputs. We have to print the area and perimeter. So, if you use any of them, then it will work. So, I will tell you that any of them is good to you. So, first we will write two printf. Then, later, we will convert the two printf into one printf. Ok? So, here comes my first printf which will print the area. Now, it is very simple. You might have understood that the backslash is there, because we have to go to the new line. So, this is the value of a. Right? Now, it seems that you have understood. Now, this perimeter equals to %f. This is also simple. Backslashm, again, cursor will come into the new line. And perimeter equals to as it is printed. And what will be printed instead of %f? It will be pre-printed. Now, in the previous example, I had told you that %0.2f will be printed. Now, in the previous example, I had told you that %0.2f will be printed. And %0.4f will be printed. Ok? So, this program has been implemented. Save and run it. Now, we will run it. So, I have inputted 2.5 length. I have entered the breadth. 5.6. Area is 14.000. How many are there? %0.4f. And perimeter is 16.20. So, after the point, only 2 digits are coming. Because we had written %0.2f. So, as you will write, it will come in the same output. And both the area and perimeter are coming in different lines. Now, you will say, remove this slashm. Remove it. Now, you will see that everything will be printed in the same line. So, %0.2f. And %0.6f. Area, perimeter is printed in the same line. It is not printed in different lines. So, you will have to believe how important is the backslashm. So, if you put backslashm, the line will change. Simple. So, it is important to practice so that you get to know what I am telling you. If you do it yourself, then you will have to believe how important is the backslashm. Okay. Now, you will say, convert 2 printf into 1 printf. Now, you will see the use of the comment. Normally, you will delete these lines. I will not delete them. They will be in the program as it is. So, it is possible that you will have to use them. So, I will put them in the comment. I have made them into comments. Now, you will see that these lines have become dead. They are physically available but they will not be executed. Now, you will see the printf. A printf is used for both the printf. Area equals to percentf. So, percent point, now, I am writing 2f. Again, backslashm, perimeter equals to percent point 2f and a comma 3. So, you have to explore the first printf. So, backslashm, new line area equals to as it is print percent point 2f will not be printed. Now, you will see the first percentf will be replaced with the first variable. The second percentf will be replaced with the second variable. So, the order matters. You cannot write it accordingly. You have to follow the first percentf, second variable and so on. Then, we have written backslashm in the middle. So, this line will change. Then, perimeter equals to as it is print and this will be replaced with value of percent. So, I have saved it. Let's compile and run it. So, 2.5, 5.7 different answer. Now, both the results have two digits after the point. As you can see, I have used point 2f and point 2f. And this area perimeter is being printed in different lines whereas, I have used only one printf. So, why did this happen? Because I have used backslashm in the middle of printf. So, it is not necessary to use backslashm in the beginning of printf. You can use backslashm in the whole printf and in the double quotes. Now, you will say that you have made a comment. As it is running, now you have two output of the same calculation. Two output of the same calculation. 2.5 and let's say 3.4 So, area equals to 8.4 digits. Now, you have 4 digits. Since, point 4f then perimeter 11.80, then area then perimeter. So, why? Because one set ये अपना दूस्रा क्याल्कूलेशनूवा, अप तार्ड बात करते है, क्याल्कूलेच तोटल अप परसंटेज माख्स। तो ये बहुत ये सिंपल होगा और अब अप मैं, बहुत बहुत क्याल्कूलेशन करके भी आप को समजा कोगा, ये बहुत बहुत क्याल्कूलेच माख्स। परसंटेज में, एक वह परसंटेज में, बहुत बहुत भी तोटल अप परसंटेज में लगा। लिए कि जो वरग किनद्र थाव तो तो स्विव तो अवने लिए तेखिल तो वट्षी कर अप95 ाो बजद्व रोड़ थाई.. ये कि काई भी थाई क्ही बाज था ग़दून के व्रीक होँ वो अवने जी कुछ तो वो लोग सेताद। ज़ैसा मैं लिख रहा हो, वैसे यापको लिखना है, क्योकि हमें सिंटेक्स को फोलो करना है, सिंटेक्स अगर गलत लिख होगे, तो एरर साएंगी, एररस को लिए मुप करना लगेगा, प्रोबलम साएंगी, और जब भी प्रोलम है, तो गवराना नहीं है, तो आपको खुष होना है क्योकि अप सिकोगे, तो कि मिस्टेक आएंगी उसको लिए मुप करोगे, तब भी तो पड़ा चलेगा, जे जागे से मुझे मिस्टेक नहीं करते है, तो आपनोरमली क्योता है क्योकि रहा है कि पैली बार में अगर अपने काम कर दिया, अगर पैली बार में गलत काम क्या तो आप सिके, क्योकि वो चीज आप लाइप लों यागर, तो तो छोड़ा सा मोटिवेशनल टाचा गया, तो वो भी साथ के साथ जरूगी है, कि प्रोग्रामिंं के लिए मोटिवेशन का आते रहना मुझ जरूगी है, तो ये प्रिंटेप स्कनव, जिस में माखस आगर तीम सबज्चके, तो ये अपना एंपोट वाला पाट कमप्लिट होगया, आब अगला पाट कोंश आता है, प्रोसिस, तो फटा फ़ से तोटल कर लिए में, ये तोटल होगया, पटिया होगया, फटा पटिया होगया, आब अगर गुई होगया, ओगया बचलॉए, आब आगर वोगे, तो �井गा नाता वोगiley, जो फटा कुँ, से भी अपना औगया, उभी यह गार वो ये एक और बबचानतेख से तबता होगया, अपने लेक्चर नबर 3 वाला वीडियो देखेंगे जिस में आपको नहीं चीजे पता चलेगी और पुट्स नहीं प्रुगरम्स तो पहले च्यूरेटिकलीस को परते हैं फिल्मेस को इंप्लिमें कर के पतावां तो अगर आप पढ़ोगे फुर्थ प्रुगरम् का जो प्रोबलम है, वो के रहीं की हमें लीएड करना है, बेसिक सेलरी, अब यहाप आप हैं पैसेगी, सेलरी, चिके, किसके एंप्लोई, तो जब आप जोब करोगे तो आपको सेलरी मिलेगी, तो नोरमली पड़ाई करते कि उच्छ और सेलरी मिलती है, थेखे, जो आपको मोटीबेशन देती है, कि हमें काम करना है, तो हमें क्या करना है, ग्रोग सेलरी निकालनी है, अब आगे वेर कनडीशन लिकिवएग, जो गी मतहमैटेख से लेलेड है, कि हमें डीव मिलेगा 40% of basic salary, और hra मिलेगा 20% of basic salary. तो अब दीखो चार कोमपनटएद होगा है, basic salary, gross salary, da and hra. इन्पूट क्या कराना आई, सच्ट बेसिक सेलरी, क्यों कि DA कलकूलेद होगा, जो कि 40% of basic salary है, तो बेसिक सलरी का 40% किस में आजाएगा दीई वेरिएबल, और आप चाहो तो इसको एसे भी लिख सकते हो, तो बेसिक सलरी इन तो 0.4 ये भी चलेगा, और ये मैं कमेंट के तु लिख हो, समजाने के लिए, तो आप ये वाला फामला भी अपलाए कर सकते हो, बेसिक सलरी इन � करवाया, उसके बाद दीई एचरे कल्कूलेट कर लिए, उसको इनपुत नी करवाया, अब ग्रोस सलरी कल्कूलेट करने के लिए करवोगे, सब को जोगे, ये आगे अपनी ग्रोस सलरी, किल सब अपनी अपन衂ँब कोर सरी, खोक्रोस सल्री करापकर स negro, Nihauffy karas, तो तोटल सेल्टी आगें तो उस परीके से अपने वेरीफाई कर लिया गी जो अमने प्रोग्राम निखा है, वो बलको सही लिए. तो दोस तो इस परीके से यह सेकिन लेक्चर कमपीट वहाँ जिस में आपको कुछ वीटीो, सोरी कुछ कुछ प्रोग्राम्स को अईक्चोली इंप्लिमेंट कर के बताया, उनसे रिलेटड़ चीजे बताय की इंप्ट अउप्ट कैसे दीशाइत करे, कैसे लोडिद बनाई. अगले वीटीो में हम बात करेंगे डेटा ताएक की, लेक्चर नमबर 3 रेखन ना बुलेए, लेक्चर नमबर 1 में अपने निट्रुटक्चन बताया था, तो तो बजोगे ताई बढ़ की, वीटियो सेगीजा जो के हिनजी में बनारा वो सगा लिंक आप को रही लیک्चर के देश्प्ष्शन में मिलेगा, तो उच्ट विलेटिस लिंक नोत फहोंगरो, उस मफ्ट तो सफारे वीटीगो वाग्ट में जाएंगे जाएंगे, उस लिंग के साथ आपको और बहुत सारे बीटियोस के लिंक्स मिलेंगे जो की एग्लिष में बनाए गया है, उनको भी देखों, ताकि आप कैसे और प्रुग्रम्स मंते है, उनके एक्ष्मनेशन देखपा हो, और अख्चे से प्रुग्रम्में को सीगे। आप आप की आप को समच में आवगा और वीटियोस को फोलोकर के रही है, आप आप को वोग्चे से प्रुग्रम्स मिलेंगे।