Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Operators in Programming: Arithmetic, Relational, and Logical, Slides of Computer Programming

An introduction to various operators used in programming, including arithmetic, relational, and logical operators. Arithmetic operators such as addition (+), subtraction (-), multiplication (*), and division (/) are explained. Relational operators like less than (<), greater than (>), less than or equal to (<=), greater than or equal to (>=), equality (==), and not equal (~=) are also covered. Logical operators & (and), | (or), and ~ (not) are introduced with examples. Matlab demos for number guessing game, quadratic equation, and finding quadratic roots.

Typology: Slides

2012/2013

Uploaded on 08/17/2013

zaid
zaid 🇮🇳

4.5

(2)

62 documents

1 / 6

Toggle sidebar

Related documents


Partial preview of the text

Download Operators in Programming: Arithmetic, Relational, and Logical and more Slides Computer Programming in PDF only on Docsity! Operators Arithmetic Operators + - * / Relational Operators < > <= >= == ~ = Logical Operators & | ~ + Addition: a + b - Subtraction: a - b * Multiplication: a * b / Division: a/b + Unary Plus: +a - Unary Minus: -a There are arithmetic operators for arrays [later] Lecture 02 Operators, Expressions docsity.com Operators Arithmetic Operators + - * / Relational Operators < > <= >= == ~ = Logical Operators & | ~ < Smaller than: a < b > Greater than: a > b <= Smaller or equal: a <= b >= Greater or equal: a >= b == Equality: a == b ∼= Not equal: a ∼= b Lecture 02 Operators, Expressions docsity.com MATLAB Demo quadratic.m function y = quadratic(a,b,c,x) y = a*xˆ2 + b*x + c; Lecture 02 Operators, Expressions docsity.com MATLAB Demo find quadratic roots.m function [r1, r2] = find quadratic roots(a,b,c) % This function computes the roots of a quadratic eqn. delta = bˆ2 − 4*a*c; mid = −b/(2*a); r1 = mid + sqrt(delta)/(2*a); r2 = mid − sqrt(delta)/(2*a); Lecture 02 Operators, Expressions docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved