Computer Programming (cp-1) Lecture# 3-4 Use of Asthmatic Operators
Computer Programming (cp-1) Lecture# 3-4 Use of Asthmatic Operators
Computer Programming (cp-1) Lecture# 3-4 Use of Asthmatic Operators
Lecture# 3-4
Use of Asthmatic Operators
Reading Material
Deitel & Deitel C++ How to
Program
chapter 1
1.22
In the Previous Lecture
Basic structure of C program
Variables and Data types
Operators
cout and cin for output and
input
Precedence
Highest: ()
Next: *,/,%
Lowest: +,-
Proper use of ()
What is the result of 10 + 10 * 5 ?
a*b%c +d
a*(b%c) = a*b%c
?
Examples of
Expressions
(use of parenthesis)
x = (a * x) + (b * y) + c * ( z * z)
Quadratic
Equation
In algebra
y = ax2 + bx + c
In C
y = a*x*x + b*x + c
Discriminant
b2 - 2a
4c
= b*b - 4*a*c /2 *a Incorrect
answer
Solution
Given a four-digit
integer, separate and
print the digits on the
screen
Solution
Lets first analyze the problem
and find out the way how to
program i
Analysis
Number = 1234
}
Special Character
Newline
\n
TIPS
Dont forget semicolon at the end
of each statement