Chapter 5
Values and Simple Math
IN THIS CHAPTER
Working with values
Using printf() to display values
Formatting floating-point output
Letting the program do the math
Dealing with integer and float math
Back in the old days, most people thought of computers in terms of math. Computers calculated rocket trajectories, conducted the census, and screwed up phone bills. They were scary, technological things, and the people who programmed computers were downright geniuses.
Ha! Fooled everyone.
Programmers merely write the equation and punch in a few numbers, and then the computer does the math. That’s the genius part. Punching in the wrong numbers is the nongenius part. Before you can get there, you have to understand a bit about values and variables and how the C programming language deals with them.
A Venue for Various Values
Computers deal with both numbers and text. Text comes in the form of individual characters or a parade of characters all tied together in a string. Numbers are ...
Get C Programming For Dummies, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.