Loading...

PPT – Arithmetic Operators and Expressions PowerPoint presentation | free to download - id: 122247-NjdlN

The Adobe Flash plugin is needed to view this content

View by Category

Presentations

Products
Sold on our sister site CrystalGraphics.com

About This Presentation

Write a Comment

User Comments (0)

Transcript and Presenter's Notes

Arithmetic Operators and Expressions

- Operands
- Arithmetic operators and their properties
- Arithmetic expressions

Lets take a look at L3_3.c p.95

Arithmetic Operators

- Addition operator
- - Subtraction operator
- Multiplication operator
- / Division operator
- Mod operator (remainder)
- No exponentiation operator must use math function

Relational and Logical Operators

- Inequality operators
- gt Greater than
- gt Greater than or equal
- lt Less than
- lt Less than or equal
- Equality operators
- equal
- ! not equal
- Logical operators
- AND
- OR
- ! NOT

Assignments

- Simple assignment operator
- Compound assignment operator
- (n 2 is the same as n n 2)
- -
- /

Increment and Decrement Operators

- increment operator
- n is same as n n 1
- -- decrement operator
- n-- is same as n n - 1

C Language Operator Precedence Chart

Example L3_4.c

Things to Remember

- When doing division make sure that it does not

involve 2 integers unless you really want the

fractional part to be cut off. - When doing an assignment to a float make sure

values on the right hand side used decimal points

(6.0 not 6) - When doing an assignment to an integer make sure

the value on the right hand side is an integer

Modifing the way C does arithmetic operations

- int aa5, bb3, cc
- float xx, yy12.3, zz18.8
- //Use cast operator to temporarily change data

type - xx ((float) aa) / ((float) bb)
- cc (int)yy (int) zz

Lesson 3.5 Reading data from the keyboard

- Using the scanf( ) function
- Entering data from the keyboard
- The address operator
- double type data

How to input data from the keyboard?

- scanf (ltformat_stringgt, ltargument_listgt)
- scanf (f lf, income, expense)

Address Of Operator

- This is used to tell C to pass the address of the

variable to the function instead of the value. - You must use with your arguments in scanf()!!

Common Errors Using Scanf

- Forgetting the address of operator ()
- Should use printf to tell user that your program

is waiting for input - prompts - Make sure to match your conversion specifications

with variable types. - Use lf for double
- Use f for floats
- Use d for ints

Math Library Functions

- Using standard math header file
- double -vs- float data type
- Other data types

How to use math functions?

- include ltmath.hgt

Example L3_7.c

How to write your programs

- Problem Statement
- Understand what you are trying to solve.
- Gather the facts (What is known).
- Do a hand calculation of an example problem

(solve a specific case). - Write an Algorithm in pseudocode.
- Use the Algorithm to write the actual program.

Application Program 3.2 Temperature Units

Conversion

- Problem Statement Write a program that creates

a table of degrees Celsius with the corresponding

degrees in Fahrenheit. Begin at 0 degrees

Celsius and go to 100 degrees Celsius in 20

degree increments.

Solution

- What data do we need
- How to convert from Celsius to Fahrenheit
- F (9/5 C) 32
- F degrees in Fahrenheit
- C degrees in Celsius
- Starting and Ending values (0 100)
- Increment (20)

Algorithm

- Declare variables (What data types to use)
- Print heading of table
- Set C starting point and calculate F
- Print C and F
- Increment C and recalculate F and stop at 100
- Print C and F for each increment

About PowerShow.com

PowerShow.com is a leading presentation/slideshow sharing website. Whether your application is business, how-to, education, medicine, school, church, sales, marketing, online training or just for fun, PowerShow.com is a great resource. And, best of all, most of its cool features are free and easy to use.

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

You can use PowerShow.com to find and download example online PowerPoint ppt presentations on just about any topic you can imagine so you can learn how to improve your own slides and presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

presentations for free. Or use it to find and download high-quality how-to PowerPoint ppt presentations with illustrated or animated slides that will teach you how to do something new, also for free. Or use it to upload your own PowerPoint slides so you can share them with your teachers, class, students, bosses, employees, customers, potential investors or the world. Or use it to create really cool photo slideshows - with 2D and 3D transitions, animation, and your choice of music - that you can share with your Facebook friends or Google+ circles. That's all free as well!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

For a small fee you can get the industry's best online privacy or publicly promote your presentations and slide shows with top rankings. But aside from that it's free. We'll even convert your presentations and slide shows into the universal Flash format with all their original multimedia glory, including animation, 2D and 3D transition effects, embedded music or other audio, or even video embedded in slides. All for free. Most of the presentations and slideshows on PowerShow.com are free to view, many are even free to download. (You can choose whether to allow people to download your original PowerPoint presentations and photo slideshows for a fee or free or not at all.) Check out PowerShow.com today - for FREE. There is truly something for everyone!

Recommended

«

/ »

Page of

«

/ »

Promoted Presentations

Related Presentations

Page of

Home About Us Terms and Conditions Privacy Policy Presentation Removal Request Contact Us Send Us Feedback

Copyright 2018 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

Copyright 2018 CrystalGraphics, Inc. — All rights Reserved. PowerShow.com is a trademark of CrystalGraphics, Inc.

The PowerPoint PPT presentation: "Arithmetic Operators and Expressions" is the property of its rightful owner.

Do you have PowerPoint slides to share? If so, share your PPT presentation slides online with PowerShow.com. It's FREE!