 Hello friends, I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video I am going to explain how you can print these series on output screen. So if you see carefully, so here x upon y square then plus x cube upon y raised to 4 then again plus x raised to 5 and y, sorry x raised to 5 upon y raised to 6 is there and this will go so on. So if you see the numerator, its power is 1, 3, 5, 7 and so on. If you see the denominator, its power is 2, 4, 6 and so on. So numerator x will be having power as odd value and denominator y will be having power as even numbers. Now if we see the second series, so digits x and y are same, powers are same. The only difference is here it will print all plus, plus, plus. But here it will print first value as plus, second as minus, then plus, then minus and so on. So we can do two operations on these series. Either we can print the terms evaluated here as x upon y square then x3 upon y4 and second what we can do, we can add all the calculated results and then print, then can print a particular value. So we will do both. So first I am going to print this one and then I will convert that implemented program for this plus minus sequence. So I am starting the program. So here I am going to use some variables. So i, then n, n will be reading the value like how many terms you want to print or add. Then we have a power, so I am having p as 1, q as 2. So p will be storing the power of numerator x and q will be storing the power of denominator y. So p started from 1, q started from 2 because x is having power as 1 and y is having as 2. Now I am declaring two load variables, x and y because I am going to divide them so there will be possibility. They will have results in decimal point. That's why I gave them a slope. Now I am writing print f, scan f so that we can read values of x, n and y from this. So enter x, y, n, n, then scan f, percent f, percent f, percent d, m percent x, m percent y, m percent n. So two are slope, that's why percent f. One is integer, that's why percent d and this is the way. Now I am going to implement a for loop. It will repeat n times. It will repeat n times. So now I am going to calculate this first. So it is x raised 1 and y raised 2. So I am going to calculate numerator first, then denominator. So let's say I am using capital N for numerator value equals to p o w x comma and here I am passing p. So x is the base and p is the part. So right now p is 1. So x raised 1 will be calculated and result will be stored inside n variable. Then I am going to calculate denominator. So p o w y comma q. So y is the denominator and its power is q, that is 2 right now. So it will be calculated. Then r equals to n upon d. This is calculated. Now I told you we need to print this calculated result as well as we need to print the sum. So calculation is available in r for this equation. So now I am going to use one more variable that is s equals to s plus r. So s will be having some of all the expressions and immediately we need to print result that is stored in r as well. So after this, I am going to print percent f. And after this I am mentioning a plus and then the value which is stored inside r. So r is having a calculated result. So let us print it with help of percent f here. Now after this, I need to increase value of p as 3 and value of q as 4. So here I am writing p equals to p plus 2 p equals to p plus 2. And after this, q equals to q plus 2. And remember here you need to put semicolon. So p will be 3 and q will be 4 because the initial value is 1 and 2 respectively. So accordingly they will be incremented. And after this I can close this column. So this column will be printing each terms. So let's say x is 3 and y is 2. So 3 upon 4 whatever will be the result will be displayed on output screen and then plus. This time will be displayed. Then next time x is 3. So 3 is 3 upon 2 is 4 and then a plus. So this expression result will be printed and along with plus time will be printed. So this way the series will be printed. Now after completion of this loop, you want to print the sum of this whole series that we are storing inside s variable. So after completion of this loop, you can print sum equals to percent f and s. And then you can complete the program. And remember to use backslashers so that that will be printed on Uline. So s will be having sum of all the expressions. So that will be printed on output screen. So now I have used some more variables. So I'm declaring them here and d r n s and I'm initializing it as 0.0. Because I'm using it to add the result. So that's why I'm initializing it with 0.0. So this way I hope you understood the implementation. So let's iterate it so that we can understand it more easily. So x is 3, y is 2, then p is 1, u is 2. So these are the initial value and here we can write s is 0.0. Now this is done then I will start from 1. This will be calculated. So x comma p. So x is 3 and p is 1. So 3 is 1 will be calculated. Result will be n. Then p o w will calculate y comma q. So y is 2 and q is 2. So 2 is 2 will be calculated. Result will be stored in d. Both will be divided. Result will be r. r will be added to s. And then a percent f plus. So 3 by 4 result and then plus will be created. And p will become 4. Sorry, p will become 3 and q will become 4 by this. Then I will be implemented for second rotation. So x is same 3. p is now 3. So 3 is 3 will be calculated and stored inside n. Then y is 2. So 2 raised 4 will be calculated and stored in d. Again they will be divided. And result will be stored inside r. r will be added to s. And after that r will be added. Sorry, r will be created on output scheme grid. Just plus. So this way the result will be created here and then plus. So accordingly this iteration will be executed. Based on the value of n. So let's say n is 5. So 5 expressions will be calculated. And their result will be displayed in terms of series with the help of this printf. And in terms of sum with the help of this printf. So I hope you understood how we can implement this kind of series with the help of C program. So this is looking very difficult, but when we start implementing it, so it's very easy. Now after implementation of this series, we need to implement this. So I'm going to give you a brief idea how you can implement this. Then you can modify this program easily. So here you can see this. This is the odd term first expression. This is even. This is again odd. Then now if we see the pattern. So odd is having plus. This odd is having plus. But even is having minus. So if we go beyond this. So again, we will be having minus x raised 7 upon y raised 8. And so on. So you need to check the value of i. If i is odd, we need to do a plus operation. If i is even, we need to do minus operation. So here I'm printing it like this for a set of plus. So now you can use this plus sign before printing this expression. And based on a value of i. So every time we need to calculate these. So I'm going to modify this right now. So that you will understand how it will be. So this is odd. Then even then odd and so on. So this will be same. This will be same. Then we need to divide this. It will be same. But here we need a plus or minus operation based on their position. So. These two will depend upon value of i. As equals to s plus r and this print out statement. Right. So let's say. I'm also removing these from here. Now here you need to write this. If. I modulate us to the very close to you. Then. Two statements. And as you can see. And. Two statements. And this block you need to write. Right. So this block will be implemented here and then. You can use these statements. And this will be same. So if i is divisible by two. It means we are going to do this. So we need to print minus sign that expression result. And if the. If the implement additional subtraction. Then that will again depend on this. So here. I'm writing this. So because this is even position. So I'm implementing s equals to s minus r. I'm subtracting it. And here I'm writing. Then minus. Percent. And now. So value of r will be printed. Value of r will be printed. In place of this person. And before that, this minus sign will be printed. Now, if we talk about autumn. So s equals to s plus r. So autumn will be added into s. And. Print it will print plus. Percent f. And now. So this way you can decide which position you are printing. Or you are calculating. So if you are calculating odd position, so it will be added and printed with a plus sign. So this way it works. I hope you understood both the implementations. So. Use this. Here. And rest of the code will remain same. For this series. And for the previous one. The two statements that you. Notice. Which were written before this implementation. That we need to use. So. In your system so that you can understand how these. So I explained you both the things. First to print the series. With the help of this printer inside you. Second. To print some of all the expressions. Using this. That is outside of you. Right. So I hope you understood whatever I explained in this video. If you want to watch. Right. So I hope you understood whatever I explained in this video. If you want to watch more programming related videos. You can open my channel. And see whatever you want. So thank you for watching this video.