 Hello and welcome. This video is part of a series. Be sure to check out the link in the description for the full playlist. Gonna try to go through this quickly. I'm gonna use Vim as my text editor. Use whatever editor you prefer. We are going to go into our code. Right now I'm calling it math.c. We have our basic C program up here with our main function and returning of zero. We're gonna do some basic math today. We're gonna create an integer we'll call a and we'll say that's equal to we'll say 6 and we'll say b equals 2 and then we're gonna create another integer down here we'll say c and we'll say that c equals a plus b and then we can use printf to print that out and what we're gonna do here is we're gonna say percent d since this is a number here we're gonna say our new line character and now here we want what number do we want to print we want print a we want print b we want print c here we'll say c so go ahead and do that and we'll compile it using gcc we'll say our math c input and then our output will just call math as our new executable dot slash saying running a command that's in this current directory called math run that and outputs 8 we can come in here and we can be we can change that if we want to instead of add we can multiply recompile it run it again we got 12 we can we can add or we just did add we can divide run that so six divide by two is three and we can also subtract we haven't done that yet right and run it again for so that's that's basic math let's go ahead and add a little bit more to this let's go ahead and change this back to just plus and let's go ahead and say percent d plus percent d equals percent d new line then here we'll do a comma and b so again these little placeholders here this is going to be replaced by whatever a is valued at this will be replaced whatever b is valued at and this will be replaced by whatever c is valued at so we can change the variables up here and I'll change it down there we should be able to compile that and I wrote something oh I forgot a comma there should be a comma right here let's go ahead and compile that again clear the screen and run it again and there we go 2 plus 6 equals 8 great let's see how long is this video we can keep ongoing let's go ahead and get the user input now we've used in the past we looked at gets which you really shouldn't use in f gets those are getting strings we want to get a numeric value you here so we're going to go up here let's go ahead and create these variables but leave them blank and what I'm going to do here is I'm going to say print f and I'm going to say enter to integers okay so we're going to get to basically kind of whole numbers here and we're going to use scan f and we're going to get two of those integers so we're going to say percent d and percent d and we're going to say that we are going to put those in I'm going to say dollar sign a comma dollar sign not dollar sign it's a dollar sign I meant ampersand ampersand b okay so now we're going to get that input from a user it's going to wait for two integers so I should be able to now recompile that and run it again it's going to ask for two integers and I can say one and two and it says one plus two equals three I can run again I can say three and six I can run again I can say 23 and 87 and does the math for me and it will also look for I can do this I can say two I can hit enter and still waiting for that second integer I can say 76 and does the math for me and if I was to give it three integers it only looks at those first two so that is some basic math there for you with grabbing the integers from the user let's go ahead and look at that again we're using scan f for this for getting those digits those integers from the user so I hope you found that useful as always please visit filmsbychrist.com that's Chris the K there should be a link in the description there you can search through my videos some of my software my scripting notes and if you like my videos you can always support me either a one-time donation with PayPal here or you can become a support over at patreon.com forward slash malix 1000 there's links to all of this in the links to this video or the description of this video as well as a link to this project here getlab.com forward slash malix 1000 forward slash my bin capital M capital B and if you look under the C folder there tutorials there are scripts that go along with this whole series I do thank you for watching and as always I hope that you have a great day