Introduction to Programming

Slides:



Advertisements
Similar presentations
Revision - Quadratic Equations Solving Quadratic equations by the Quadratic Formula. By I Porter.
Advertisements

11.3 Solving Quadratic Equations by the Quadratic Formula
EXAMPLE 4 Use the discriminant Find the discriminant of the quadratic equation and give the number and type of solutions of the equation. a. x 2 – 8x +
IB HL Adrian Sparrow Factor and remainder theorem.
solution If a quadratic equation is in the form ax 2 + c = 0, no bx term, then it is easier to solve the equation by finding the square roots. Solve.
Introduction to Computers and Programming Lecture 4: Mathematical Operators New York University.
Introduction A trinomial of the form that can be written as the square of a binomial is called a perfect square trinomial. We can solve quadratic equations.
1 Interactive Applications (CLI) and Math Interactive Applications Command Line Interfaces The Math Class Example: Solving Quadratic Equations Example:
Essential Question: What are some things the discriminate is used for?
Lesson 1-6 Solving Quadratic Equations. Objective:
5.3 Discriminant and 5.4Find ABC Discriminant: b 2 – 4ac A, B, C ax 2 + bx + c = 0.
Solving Quadratic Equations Section 1.3
Copyright © Cengage Learning. All rights reserved.
4.8: Quadratic Formula HW: worksheet
VARIABLES, TYPES, INPUT/OUTPUT, ASSIGNMENT OPERATION Shieu-Hong Lin MATH/CS Department Chapel.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
EXAMPLE 1 Factor ax 2 + bx + c where c > 0 Factor 5x 2 – 17x + 6. SOLUTION You want 5x 2 – 17x + 6 = (kx + m)(lx + n) where k and l are factors of 5 and.
6.5 – Solving Equations with Quadratic Techniques.
Quadratic Equations By Dr. Carol A. Marinas. Solving Equations In the previous section, we solved LINEAR equations. This means that the highest exponent.
Using the factoring method, what are the solutions of y = x 2 + 5x + 6.
EXAMPLE 2 Rationalize denominators of fractions Simplify
Quadratics Solving equations Using “Completing the Square”
Lecture #6 OPERATORS AND ITS TYPES By Shahid Naseem (Lecturer)
4.8 Do Now: practice of 4.7 The area of a rectangle is 50. If the width is x and the length is x Solve for x by completing the square.
SOLVING QUADRATIC EQUATIONS BY COMPLETING THE SQUARE BECAUSE GRAPHING IS SOMETIMES INACCURATE, ALGEBRA CAN BE USED TO FIND EXACT SOLUTIONS. ONE OF THOSE.
COMP102 Lab 021 COMP 102 Programming Fundamentals I Presented by : Timture Choi.
Introduction to Programming Lecture 11. ARRAYS They are special kind of data type They are special kind of data type They are like data structures in.
Introduction Completing the square can be a long process, and not all quadratic expressions can be factored. Rather than completing the square or factoring,
"Give a person a fish and you feed them for a day; teach that person to use the Internet and they won't bother you for weeks.“ --unknown "Treat your password.
Introduction to C Programming Lecture 6. Functions – Call by value – Call by reference Arrays Today's Lecture Includes.
Arithmetic Expressions Addition (+) Subtraction (-) Multiplication (*) Division (/) –Integer –Real Number Mod Operator (%) Same as regular Depends on the.
This formula finds the solution(s) for x in any quadratic equation.
Solving Quadratic Formula using the discriminant.
13.1 Introduction to Quadratic Equations
Introduction to Programming Lecture 4. Key Words of C main main if if else else while while do do for for.
Getting Started The objective is to be able to solve any quadratic equation by using the quadratic formula. Quadratic Equation - An equation in x that.
Arithmetic Operations (L05) * Arithmetic Operations * Variables * Declaration Statement * Software Development Procedure Problem Solving Using C Dr. Ming.
Warm-Up Exercises EXAMPLE 1 Standardized Test Practice What are the solutions of 3x 2 + 5x = 8? –1 and – A 8 3 B –1 and 8 3 C 1 and – 8 3 D 1 and 8 3 SOLUTION.
Unit 5 Solving Quadratics By Square Roots Method and Completing the Square.
Solving Quadratic Equations by Using the Quadratic Formula (9-5) Objective: Solve quadratic equations by using the Quadratic Formula. Use the discriminant.
Warm Up  1.) Write 15x 2 + 6x = 14x in standard form. (ax 2 + bx + c = 0)  2.) Evaluate b 2 – 4ac when a = 3, b = -6, and c = 5.
2.2 Solving Quadratic Equations Algebraically Quadratic Equation: Equation written in the form ax 2 + bx + c = 0 ( where a ≠ 0). Zero Product Property:
Introduction to Computer Programming
Deriving the Quadratic Formula
5.6 Quadratic Formula & Discriminant
Chapter 4 Quadratic Equations
Chapter 2 Introduction to C++ Programming
Variables Mr. Crone.
EXAMPLE 2 Rationalize denominators of fractions Simplify
Programming Fundamental
Solve a literal equation
The Quadratic Formula..
Introduction to C++ Programming
Introduction to Programming
Programming Funamental slides
Introduction to Programming
Conditional Construct
9-6 The Quadratic Formula and Discriminant
Counting Loops.
Standard Form: Ax + By = C
Intro to Programming Week # 2 Variables/Data type Lecture # 4 & 5
Tests of Divisibility 1 - All integers can be divided by 1
Programs written in C and C++ can run on many different computers
Engineering Problem Solving with C++ An Object Based Approach
Using string type variables
Warm Up #4 1. Write 15x2 + 6x = 14x2 – 12 in standard form. ANSWER
5.4 Completing the Square.
Functions Divide and Conquer
Solving Equations by Factoring
Programming Fundamental-1
Presentation transcript:

Introduction to Programming Lecture 3 https://sites.google.com/site/cs303uaf

Key Words of C main if else while do for

Memory x x = 2 + 4 ; = 6 ; 6

Memory a b x = a + b ; x

#include <iostream #include <iostream.h> main ( ) { int age1, age2, age3, age4, age5, age6, age7, age8, age9, age10 ; int TotalAge ; int AverageAge ; cout << “ Please enter the age of student 1: “ ; cin >> age1 ; cout << “ Please enter the age of student 2: “ ; cin >> age2 ; : TotalAge = age1+ age2 + age3+ age4+ age5+age6+ age7+ age8+age9 + age10 ; AverageAge = TotalAge / 10 ; cout<< “The average age of the class is :” << AverageAge ; }

Quadratic Equation y = a*x*x + b*x + c In algebra In C y = ax2 + bx + c In C y = a*x*x + b*x + c

a*b%c +d

a*(b%c) = a*b%c ?

Discriminant b2 - 2a 4c = b*b - 4*a*c /2 *a Incorrect answer Solution = (b*b - 4*a*c) /(2 *a) Correct answer

No expression on the left hand side of the assignment Integer division truncates fractional part Liberal use of brackets/parenthesis

Interesting Problem Given a four-digit integer, separate and print the digits on the screen

Analysis Number = 1234 Take the remainder of the above number after dividing by 10 Eg 1234 / 10 gives remainder 4 1234 % 10 = 4 Remove last digit 1234/10 = 123.4 123 (Truncation due to Integer Division) 123 %10 gives 3 123/10 = 12.3 12 (Truncation due to Integer Division) 12 % 10 gives remainder 2 12/10 = 1.2 1 (Truncation due to Integer Division) Final digit remains

Code #include <iostream.h> main ( ) { int number; int digit; cout << “Please enter a 4 digit integer : ”; cin >> number; digit = number %10; cout <<“The digit is: “ << digit << ‘\n’; // first digit; and then << ‘\n’ number = number / 10; digit = number % 10; cout <<“The digit is: “ << digit << ‘\n’; cout <<“The digit is: “ << digit; }

Special Character Newline