[adrotate banner=”7″]

 
Because you’re going to allow the user to answer to values such as May they’re calculating their age. Well, what if they put the year that they were born first like 1986, and they said, try to subtract the current year from it like 2014? Well, if they did that, then it’s going to give you a negative number, because you’re subtracting a bigger number from a smaller one and of course their age wouldn’t be negative 28. So you need to convert that to a positive number. So your program doesn’t crash so again, it’s good for distances and weights and ages. So I’ll show you guys how to build a simple program like that right now, so we’ll go ahead and put into year 1 and int year 2, which is pretty much going to be the two years that they enter to calculate the age of something and we’re Store the final age right there now for printf let’s just go ahead and give them a nice little prompt on the screen be like enter a year now enter a tear. You have to be crying to use this program. All right enter a year, newline and we’ll. Just scanf and for this, of course, for scanning percent D, since we love weird with integers and ampersand year and tyr year, one all right so now, whatever value they entered, hopefully it was an integer. We store it in year, one of course we need to do this again enter another year and store that in year.

Two, so now we got two numbers integers. So the first thing we need to do is make an equation to calculate the age. So H equals year 1 minus year 2. Now this actually doesn’t matter since we’re going to be using absolute value, you can put your two minus two one. You know it won’t make a difference, cool little thing about this. So what I want to do after this is actually print out the value that we came up with first, the value or the original value that we calculated without using absolute value so for now percent the new line and age. Now, after this, what we’re going to do is we’re, going to figure that this number that we came up with can either be the correct one if they entered armed, you know one of the numbers first or the wrong one. It can be negative if they enter the smaller number first, so no matter what we want to go ahead and calculate the absolute value using the function, a be s. So, whenever we pass age into here, if it’s a negative number is going to convert it, convert it into the positive number. If it’s positive is just going to leave it the same so now when you print that bad boy out again check it out, enter your year, 1986 enter another year, 2014, okay, so this one they tried to subtract 2014 from 1986 and it got negative 28.

Well, you don’t want to put that into your program, or else it’s going to crash everything later on. So the absolute value converts that to 28 and of course, if they entered it correctly, which is 2014 1986, it calculates 28 and leaves it at 28. So again, whenever you’re developing software, you always want to assume that the user is going to F something up and you want to make your program is user proof as possible. So using absolute value is a great way to do that sometimes it’s necessary whenever you’re using distances like. If I was to put two distances in there, then either way would be the correct way for the user. So you would still need to use absolute value, same thing with weights and so on and so forth, so um for now, that’s – probably good for this tutorial. Thank you guys for watching actually might as well show you guys some other small ones. Real quick and uh let’s see what I can do go ahead and do this so we’ll just use one print statement and we’ll print out a couple floats and I don’t need to make a whole tutorial for these um. The first one is this function POW. Now this means is, whenever you run this, you have to punch your computer as hard as you can until your fist goes. Pow I’m just kidding actually stands for power, and you need to enter two values for this.

The first one is the base and the second one is the exponent. What this is pretty much saying is: I want to see 5 to the third power. So if you guys don’t know what this is, it should be 125, so pretty much 5 times. 5 is 25 times, 5 is 125, so that’s. What that does again, I don’t need a whole tutorial explaining that and the only other one I wanted mention. Real quick is SQ RT. This stands for squirt and you have to squirt water on your computer. Just kind of good, so this actually stands for square root and whatever number you pass in like 164, it prints the square root of that number. So before I run this, can you guess what it is square root of 164? Probably, on a twelve point, six or something twelve point – eight I was close, but basically the square root of 164 is twelve point. Eight, maybe you guys gets closer than me. So those are a few math functions again out of all of those you’re, probably going to be using absolute value the most, but now you have the power function and square root on hand so well for now.

 
 

[adrotate banner=”1″]

arduino abs Video

[mam_video id=VcEHkVStszM]

 

 

[adrotate banner=”2″]

 

[mam_tag id=298]

 

 

[adrotate banner=”3″]

 

arduino abs news

 

 

 

 

 

[adrotate banner=”4″]

 

 

arduino abs Social

 

 

[adrotate banner=”5″]

 

 

official.arduino
2019-09-12T13:55:21+0000

A modular, Arduino Mega-controlled delta robot for your desktop.
official.arduino
2019-09-12T12:41:57+0000

This interactive floor recalls the precariousness of standing on an icy surface, enhanced with imagery, sounds and physical dynamics.

BalamSinhue
Tue Feb 28 05:37:05 +0000 2012

RT @arduino: Researchers are designing a convolutional neural network approach towards self-driving cars with the help of Arduino: https://…


pablobgp
Wed Jul 22 19:22:37 +0000 2009

RT @arduino: Researchers are designing a convolutional neural network approach towards self-driving cars with the help of Arduino: https://…

Portable USB Vacuum Electric Pump Quick Seal Bag Strong Suction for Food Storage

Electrical Box Project Enclosure Case Electronic Wire Dustproof Waterproof DIY

 

[adrotate banner=”6″]