CHAPTER 2:BASIC FORTRAN Data Types INTEGER REAL COMPLEX CHARACTER LOGICAL.

Slides:



Advertisements
Similar presentations
Introduction to arrays
Advertisements

Chapter 3 Program Design And Branching Structures.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Lecture Set 4 Data Types and Variables Part B – Variables, Constants, Expressions Conversion Rules Options Strict, Option Explicit Scope of Definition.
1 Chapter 2 Basic Elements of Fortran Programming.
ALGEBRA 1 BASICS CHEAT SHEET THINGS YOU SHOULD KNOW . . .
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
1 ICS 101 – LAB 2 Arithmetic Operations I Putu Danu Raharja kfupm.edu.sa Information & Computer Science Department CCSE - King Fahd University.
1.1 Some Basics of Algebra Algebraic Expressions and Their Use
10 November JavaScript. Presentation Hints What do YOU think makes a good presentation Some of my suggestions Don’t write full sentences on slides Talk,
1 Chapter 3 Arithmetic Expressions. 2 Chapter 3 Topics l Overview of Java Data Types l Numeric Data Types l Declarations for Numeric Expressions l Simple.
COMPSCI 125 Spring 2005 ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 3: Numeric Data *Variables *Numeric data.
Chapter 2 Basic Elements of Fortan
Chapter 3 Numerical Data. Topics Variables Numeric data types Assignment Expressions.
An Introduction to Programming with C++ Fifth Edition Chapter 4 Chapter 4: Variables, Constants, and Arithmetic Operators.
Chapter 2: Introduction to C++.
1 BIL106E Introduction to Scientific & Engineering Computing Organizational matters Fortran 90 ( subset F ): Basics Example programs in detail.
Exponent Rules – Day 1 Zero and Negative Exponents.
Section 1.1 Numbers and Their Properties.
Sets and Expressions Number Sets
Variables, Assignment & Math Storing and naming data.
Homework: p odd, odd, odd, odd, and odd.
CHAPTER 2 PART #4 OPERATOR 2 nd semester King Saud University College of Applied studies and Community Service Csc 1101 By: Asma Alosaimi Edited.
Operations with Fractions
Copyright 1999 by Larry Fuhrer. Pascal Programming Getting Started...
1 Chapter 3 Numeric Types, Expressions, and Output Dale/Weems/Headington.
Chapter 4 Techniques of Differentiation Sections 4.1, 4.2, and 4.3.
1 Week 2 n Organizational matters n Fortran 90 (subset F): Basics n Example programs in detail.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Slide 7- 1 Copyright © 2012 Pearson Education, Inc.
1 C++ Data Types structured array struct union class address pointer reference simple integral enum char short int long bool floating float double long.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
MM150 Unit 3 Seminar Agenda Seminar Topics Order of Operations Linear Equations in One Variable Formulas Applications of Linear Equations.
Chapter 2 Copyright © 2015, 2011, 2007 Pearson Education, Inc. Chapter Copyright © 2015, 2011, 2007 Pearson Education, Inc. Chapter 2-1 Solving Linear.
THE REAL NUMBERS College Algebra. Sets Set notation Union of sets Intersection of sets Subsets Combinations of three or more sets Applications.
Lecture III Start programming in Fortran Yi Lin Jan 11, 2007.
CHAPTER 1 INTRODUCTION TO COMPUTING 1.1 Introduction.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 2A Reading, Processing and Displaying Data (Concepts)
Evaluating Integer Expressions Friday, December 25, 2015.
Doing math In java.
Copyright © 2014, 2010, and 2006 Pearson Education, Inc. Chapter 1 Introduction to Algebraic Expressions.
 Constants A constant is a fixed value of a data type that cannot be changed Integer Constants Whole numbers → Do not have decimal points Examples: 83.
Lesson 4 : Exponent Laws I Check it out... Can you see a short cut rule?
Chapter P Prerequisites: Fundamental Concepts of Algebra Copyright © 2014, 2010, 2007 Pearson Education, Inc. 1 P.2 Exponents and Scientific Notation.
Opener: Find three consecutive odd integers whose sum is -63 Integer #1 = n Integer #2 = n + 2 Integer #3 = n + 4 (n) + (n + 2) + (n + 4) = -63 3n + 6.
1Object-Oriented Program Development Using C++ Built-in Data Types Data type –Range of values –Set of operations on those values Literal: refers to acceptable.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Monomials Chapter 5.1. Vocabulary Monomial: an expression that is a number, a variable, or the product of a number and one or more variables. – Can not.
1 Sections 3.1 – 3.2a Basic Syntax and Semantics Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
CHAPTER R: Basic Concepts of Algebra
Addition/ Subtraction
ITEC113 Algorithms and Programming Techniques
Number Systems INTRODUCTION.
Basic Rules Of ALGEBRA.
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Lecture Set 4 Data Types and Variables
EXPRESSIONS We have studied the following in the previous term. 11 = (1 x 10) + 1, 12 = (1 x 10) = (2 x 10) In the above numerical expressions.
Core Objects, Variables, Input, and Output
A mathematical phase containing numbers.
Chapter 1 Section 1 Algebraic Expressions, Real Numbers, and Interval Notation.
Chapter 2: Introduction to C++.
A mathematical phase containing numbers.
Algebraic Expressions
An Introduction to Programming with C++ Fifth Edition
Operator King Saud University
DATA TYPES AND OPERATIONS
Variables and Constants
ICS 101 Lab 3 Hossain Arif ICS Dept
Presentation transcript:

CHAPTER 2:BASIC FORTRAN Data Types INTEGER REAL COMPLEX CHARACTER LOGICAL

INTEGERS A whole Number NO Commas or A Decimal Point 9,

E2 REALS Decimal Numbers Exponential Notation 9,99 16

Mass K_S_U R4U MASS Identifiers -Names used to identify - Begin with a letter -Max 30 characters R-U 4all

Variables associated with a memory locationVariable names are identifiersthe type of any variable used must be declared CHARACTER(n)::Name n:Length

INTEGER :: Student_ID REAL ::Age CHARACTER (LEN = 15) : : FirstName, LastName CHARACTER(15) : : FisrtName, LastName CHARACTER(15) : : FirstName, LastName*20, Initial*1

IMPLICIT NONE Statement undeclared identifier whose name begins with I, J, K, L, M, or N  integer All other will be types as real IMPLICIT NONE Every data MUST be defined!

2.3 Numeric Operations The following characters are used in FORTRAN as denoted: * multiplication -subtraction + addition /division ** exponentiation

When two constants or variables of the same type are combined  result has the same type Examples: 9/4 9.0/4.0

Mixed-Mode Expressions 1.0 / 4 »» / 5 »» / 5 »» 1.0 / 4.0 »» »» »» / 5.0 »» »» »» 4.6 CHECK: (-4.0)**2 (-4.0)**2.0

Priority Rules Exponentiations are performed first; Multiplications and divisions are performed next, in the appearance order. The additions and subtractions are performed last, in the appearance order. Parentheses can be used to modify the standard order of evaluation.

EXAMPLES 2 ** 3 ** 2 = 2 ** 9 = – 8 – 2 = 2 -2 = 0 10 / 5 * 2 = 2 * 2 = / 2 = = ** 2 / 2 = / 2 = 2+ 8 = 10

(5 * (11 – 5) ** 2) * = (5 * 6 ** 2) * = 180 * = = 729

Lab Assessment: Q.1: Calculate these operations manually then by FORTRAN 5 * (11 – 5) ** 2 * = 5 * (11 – 5) ** (2 * 4) + 9 = 5 * (11 – 5) ** 2 * (4 + 9) = 5 * (11 – 5) ** 2 * 4 / 9 = 5 * (11 – 5) ** 2 * 4.0 / 9 =

Q.2: Write a FORTRAN code to design an ID card for you to include the following: Name, ID No., Age, University and College. King Saud University Collage of Engineering Your Name Your ID No. Your Age