Size: px
Start display at page:

Transcription

2 Introduction Operator: An operator is a symbol that tells the Computer to perform certain mathematical or logical manipulations. Expression: An expression is a sequence of operands and operators that reduces to single value. An expression is a formula consisting of 1 or more operators. The operation are represented by operators. Eg: is an expression whose value is Simple Expressions 5+6; or a + b; 2. Complex Expressions a * b/c + d; C operators can be classified into a no. of categories.: 1. Arithmetic 2. Relational 3. Logical 4. Assignment 5. Increment and Decrement 6. Conditional 7. Bitwise 8. Special

3 Arithmetic Operators These are also called binary operators. These operate on two or more operands. C provides 5 basic binary arithmetic operators as it is requires two values to calculate the final answer. Arithmetic operators are also called as Mathematical Operators. Operator Symbol Addition + Subtraction - Multiplication * Division / Modulo division % % cannot be used for floating point data. Note : During modulo division, sign of the result is always the sign of the first operand (the dividend ).

4 Integer Arithmetic: When the operands in an expression are integers then the expression is an integer expression and the operation is called integer arithmetic. This always yields an integer value. Real Arithmetic / Floating Pont Arithmetic: Floating Point Arithmetic involves only real operands of decimal or exponential notation. Mixed mode Arithmetic: When one of the operands is real and the other is integer the expression is a mixed mode arithmetic expression.

5 Relational Operator These are used to compare or determine relation among two operands. Operands can be either constant or variable. These are the operators used to Compare arithmetic, logical and character expressions. The value of a relational express is either one or zero. It is 1(one) if specified relation is true and 0(zero) if it is false. Operator Meaning < is less than < = is less than or equal to > is greater than or equal to > = is greater than or equal to = = is equal to! = is not equal to

6 Logical Operator It is used to combine two or more relational expressions. Logical Operators are used when we want to test more than one condition and make decisions. Operator Meaning && AND a=5, b=7, c= 9 (a<b) && (a<c) (a>b) && (a<c) True(1) False(0) OR (b<a) (a<c) True(1) (b<a) (c<b) False(0)! NOT!(a<b) False(0)!(a>b) True(1)

7 A B A&&B A B!A void main ( ) { clrscr ( ); printf( In 5>3 && 5<10 : %d, 5>3&&5<10); printf( In 8<5 5= =5 : %d, 8<5 5= =5); printf( In!(8 = =8) : %d,!(8= =8)) ; } Output: In 5>3 && 5<10 : 1 In 8<5 5= =5 : 1 In!(8 = =8) : 0

8 Assignment Operator Used to assign the result of an expression to a variable. = is the assignment operator. In addition C has a set of short hand assignment operators of the form Var Op = Exp ; Operator Symbol Example Result Assignment Operator = a = 10; Addition Assignment Operator += a+=15; a=a+15 Subtraction Assignment Operator -= a-=10; a=a-10 Multiplication Assignment Operator *= a*=n+1 a=a*(n+1) Division Assignment Operator /= a/=n+1 a=a/(n+1) Modulus Assignment Operator %= a%=2; a=a%2

9 The use of shorthand assignment operators has advantage: 1) what appears on the left-hand side need not be repeated and therefore it becomes easier to write. For example: value(5*j-2) = value(5*j-2) + delta using shorthand assignment operator value(5*j-2) += delta

10 Increment and Decrement Operators(unary operators ) The increment and decrement operators can be used only with variables, not with constants. The operation performed is to add one to or subtract one from the operand. Operator Increment Operator ++ Decrement Operator -- Meaning ++x or x ++ == > x+=1 == > x=x+1 -- x or x- - == > x-=1 == > x=x-1 A Prefix/pre-increment operator first increment the operand and then the result is assigned to the variable on left. A postfix operator first assigns the value to the variable on the left and the increments the operand. m = 5; m = 5; y = ++m; y = m++ O/P m =6, y=6 O/P m=6, y=5

11 WAP to show the effect of increment and decrement operators main ( ) { int x = 10, y = 20, z, a ; z= x * y ++; a = x * y ; printf( %d % d\n, z,a); z = x * ++y; a = x * y; printf( %d %d\n, z, a); } OUTPUT:

12 main() { int count = 0, loop; loop = ++count; printf("loop = %d, count = %d\n", loop, count); loop = count++; printf("loop = %d, count = %d\n", loop, count); } Output: loop = 1, count = 1 loop = 1; count = 2

13 #include<stdio.h> void main() { } int x=1,y=2,z; z=x y + y++; printf( z=%d",z); printf( x=%d",x); printf( y=%d",y); Output: z=7 x = 2 y= 4

14 Conditional Operator The Conditional operator is used to check condition whether true or false. The result will be as per calculated by the statement. Syntax for conditional operators is Expression1? Expression 2 : Expression 3; True Expression 1? Expression 2: Expression 3; False

15 void main() { int a,b; printf("\n\nenter First No. = "); scanf("%d",&a); printf("\nenter Second No. = "); scanf("%d",&b); (a<b)?printf("\n\n\a\tfirst No. i.e. %d is smaller",a):printf("\n\n\a\tsecond No. i.e. %d is smaller",b); getch(); }

16 Bitwise operator C Supports a Special operator known as Bitwise operator which provides bit level manipulation. It is used to test the bits or may be shifted right or left. Operator & ^ ~ >> << Description Example: c=a&b, Answer=0 a=1,b=2 so And Operator Or Operator a=0001,b=0010, now 0001 & 0010 = 0000 Excusive OR Operator Compliment Operator Right Shift Operator Left Shift Operator

17 Bit1 Bit2 Bit1&Bit2 Bit1 Bit2 Bit1 ^ Bit void main () { int x=15,y=8; printf( Bitwise AND = %d", x&y); printf( Bitwise OR = %d", x y); printf( Bitwise Exclusive OR = %d", x ^ y); printf( Bitwise complement = %d", ~ y); printf( Bitwise left shift = %d", y << 1); printf( Bitwise right shift = %d", y >> 2 ); getch(); } Output: Bitwise AND = 8 Bitwise OR = 15 Bitwise Exclusive OR =7 Bitwise complement = 245 Bitwise left shift = 16 Bitwise right shift = 2

18 Special operator Comma operator Sizeof operator

19 Type conversion and Type casting Type conversion : Automatic (lower type to higher type) Rules: 1) If float is assigned to integer, fractional part is truncated. 2) If double is assigned to float, then rounding take place. 3) If long int is assigned to integer, then additional bits are dropped. Type casting : By user Synatx: (typename) expression

20 Example: void main () { int a = 5,b; float c = 5.5; double d = 4.0; b = a * c + d/10; printf( Ans is = %d", b ); getch(); } Output: Ans is = 27 void main () { int sum = 47,n= 10; float avg; avg = sum / n; printf( Ans is = %f", avg ); avg = (float) sum / n; printf( Ans is = %f", avg ); avg = (float) (sum / n); printf( Ans is = %f", avg ); getch(); } Output: Ans is = 4.0 Ans is = 4.7 Ans is = 4.0

### Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators

### Operators and Expressions:

Operators and Expressions: Operators and expression using numeric and relational operators, mixed operands, type conversion, logical operators, bit operations, assignment operator, operator precedence

### UNIT 3 OPERATORS. [Marks- 12]

1 UNIT 3 OPERATORS [Marks- 12] SYLLABUS 2 INTRODUCTION C supports a rich set of operators such as +, -, *,,

### Operators in C. Staff Incharge: S.Sasirekha

Operators in C Staff Incharge: S.Sasirekha Operators An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C

### GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.

### Department of Computer Science

Department of Computer Science Definition An operator is a symbol (+,-,*,/) that directs the computer to perform certain mathematical or logical manipulations and is usually used to manipulate data and

### Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires

### Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.

### Informatics Ingeniería en Electrónica y Automática Industrial

Informatics Ingeniería en Electrónica y Automática Industrial Operators and expressions in C Operators and expressions in C Numerical expressions and operators Arithmetical operators Relational and logical

### Unit-2 (Operators) ANAND KR.SRIVASTAVA

Unit-2 (Operators) ANAND KR.SRIVASTAVA 1 Operators in C ( use of operators in C ) Operators are the symbol, to perform some operation ( calculation, manipulation). Set of Operations are used in completion

### Unit 3. Operators. School of Science and Technology INTRODUCTION

INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.

### Operators. Java operators are classified into three categories:

Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

### Data Types and Variables in C language

Data Types and Variables in C language Disclaimer The slides are prepared from various sources. The purpose of the slides is for academic use only Operators in C C supports a rich set of operators. Operators

### Operators in java Operator operands.

Operators in java Operator in java is a symbol that is used to perform operations and the objects of operation are referred as operands. There are many types of operators in java such as unary operator,

### JAVA OPERATORS GENERAL

JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

### Chapter 3: Operators, Expressions and Type Conversion

101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To

### Expressions and Statementst t. Assignment Operator. C Programming Lecture 6 : Operators. Expression

Expressions and Statementst t Expression C Programming Lecture 6 : Operators Combination of constants,variables,operators, operators and function calls a+b 3.0*x 9.66553 tan(angle) Statement An expression

### Basics of Programming

Unit 2 Basics of Programming Problem Analysis When we are going to develop any solution to the problem, we must fully understand the nature of the problem and what we want the program to do. Without the

### A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object

### Expression and Operator

Expression and Operator Examples: Two types: Expressions and Operators 3 + 5; x; x=0; x=x+1; printf("%d",x); Function calls The expressions formed by data and operators An expression in C usually has a

### Arithmetic Operators. Portability: Printing Numbers

Arithmetic Operators Normal binary arithmetic operators: + - * / Modulus or remainder operator: % x%y is the remainder when x is divided by y well defined only when x > 0 and y > 0 Unary operators: - +

### Constants and Variables

DATA STORAGE Constants and Variables In many introductory courses you will come across characteristics or elements such as rates, outputs, income, etc., measured by numerical values. Some of these will

### UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . \$, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

### Expressions. Arithmetic expressions. Logical expressions. Assignment expression. n Variables and constants linked with operators

Expressions 1 Expressions n Variables and constants linked with operators Arithmetic expressions n Uses arithmetic operators n Can evaluate to any value Logical expressions n Uses relational and logical

### COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

### Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Basic Operators Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

### 3. EXPRESSIONS. It is a sequence of operands and operators that reduce to a single value.

3. EXPRESSIONS It is a sequence of operands and operators that reduce to a single value. Operator : It is a symbolic token that represents an action to be taken. Ex: * is an multiplication operator. Operand:

### Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators

Operators Overview Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operands and Operators Mathematical or logical relationships

### Reserved Words and Identifiers

1 Programming in C Reserved Words and Identifiers Reserved word Word that has a specific meaning in C Ex: int, return Identifier Word used to name and refer to a data element or object manipulated by the

### Information Science 1

Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting

### Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only

### Operators & Expressions

Operators & Expressions Operator An operator is a symbol used to indicate a specific operation on variables in a program. Example : symbol + is an add operator that adds two data items called operands.

### Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits

### A flow chart is a graphical or symbolic representation of a process.

Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of

### UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

### Chapter 4: Basic C Operators

Chapter 4: Basic C Operators In this chapter, you will learn about: Arithmetic operators Unary operators Binary operators Assignment operators Equalities and relational operators Logical operators Conditional

### DEPARTMENT OF MATHS, MJ COLLEGE

T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

### Computer System and programming in C

1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign

### PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Basic Science and Humanities

INTERNAL ASSESSMENT TEST 1 SOLUTION PART 1 1 a Define algorithm. Write an algorithm to find sum and average of three numbers. 4 An Algorithm is a step by step procedure to solve a given problem in finite

### P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS)

FACULTY: Ms. Saritha P.E.S. INSTITUTE OF TECHNOLOGY BANGALORE SOUTH CAMPUS 1 ST INTERNAL ASSESMENT TEST (SCEME AND SOLUTIONS) SUBJECT / CODE: Programming in C and Data Structures- 15PCD13 What is token?

### Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

### I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.

I Internal Examination Sept. 2018 Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. [I]Very short answer questions (Max 40 words). (5 * 2 = 10) 1. What is

### Expressions and Precedence. Last updated 12/10/18

Expressions and Precedence Last updated 12/10/18 Expression: Sequence of Operators and Operands that reduce to a single value Simple and Complex Expressions Subject to Precedence and Associativity Six

### C Programming Class I

C Programming Class I Generation of C Language Introduction to C 1. In 1967, Martin Richards developed a language called BCPL (Basic Combined Programming Language) 2. In 1970, Ken Thompson created a language

### More Programming Constructs -- Introduction

More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

### Infix to Postfix Conversion

Infix to Postfix Conversion Infix to Postfix Conversion Stacks are widely used in the design and implementation of compilers. For example, they are used to convert arithmetic expressions from infix notation

### LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words

### Chapter 4. Operations on Data

Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations

### Programming for Engineers Iteration

Programming for Engineers Iteration ICEN 200 Spring 2018 Prof. Dola Saha 1 Data type conversions Grade average example,-./0 class average = 23450-67 893/0298 Grade and number of students can be integers

### These are reserved words of the C language. For example int, float, if, else, for, while etc.

Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.

### Operators and Type Conversion. By Avani M. Sakhapara Assistant Professor, IT Dept, KJSCE

Operators and Type Conversion By Avani M. Sakhapara Assistant Professor, IT Dept, KJSCE Introduction An operator is a symbol which represents a particular operation that can be performed on some data.

### The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y

### The Arithmetic Operators

The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x

### UNIVERSITY OF LIMERICK OLLSCOIL LUIMNIGH COLLEGE OF INFORMATICS & ELECTRONICS DEPARTMENT OF ELECTRONIC & COMPUTER ENGINEERING

UNIVERSITY OF LIMERICK OLLSCOIL LUIMNIGH COLLEGE OF INFORMATICS & ELECTRONICS DEPARTMENT OF ELECTRONIC & COMPUTER ENGINEERING MODULE CODE: MODULE TITLE: ET4131 Introduction to Computer Programming SEMESTER:

### Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1

Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions

### Programming in C and Data Structures [15PCD13/23] 1. PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme]

Programming in C and Data Structures [15PCD13/23] 1 PROGRAMMING IN C AND DATA STRUCTURES [As per Choice Based Credit System (CBCS) scheme] Course objectives: The objectives of this course is to make students

### 2. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them.

1. Why do you think C++ was not named ++C? C++ is a super set of language C. All the basic features of C are used in C++ in their original form C++ can be described as C+ some additional features. Therefore,

### Outline. Performing Computations. Outline (cont) Expressions in C. Some Expression Formats. Types for Operands

Performing Computations C provides operators that can be applied to calculate expressions: tax is 8.5% of the total sale expression: tax = 0.085 * totalsale Need to specify what operations are legal, how

### Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

### SECTION II: LANGUAGE BASICS

Chapter 5 SECTION II: LANGUAGE BASICS Operators Chapter 04: Basic Fundamentals demonstrated declaring and initializing variables. This chapter depicts how to do something with them, using operators. Operators

### Laboratory 3 OPERATORS, EXPRESSIONS, INSTRUCTIONS I. THEORETICAL BACKGROUND

PROGRAMMING LANGUAGES Laboratory 3 OPERATORS, EXPRESSIONS, INSTRUCTIONS I. THEORETICAL BACKGROUND 1. Operators and expressions An expression combines variables and constants in order to produce new values.

### 3. Types of Algorithmic and Program Instructions

3. Types of Algorithmic and Program Instructions Objectives 1. Introduce programming language concepts of variables, constants and their data types 2. Introduce types of algorithmic and program instructions

### Data Handing in Python

Data Handing in Python As per CBSE curriculum Class 11 Chapter- 3 By- Neha Tyagi PGT (CS) KV 5 Jaipur(II Shift) Jaipur Region Introduction In this chapter we will learn data types, variables, operators

### COMP 208 Computers in Engineering

COMP 208 Computers in Engineering Lecture 14 Jun Wang School of Computer Science McGill University Fall 2007 COMP 208 - Lecture 14 1 Review: basics of C C is case sensitive 2 types of comments: /* */,

### Week 2: Console I/O and Operators Arithmetic Operators. Integer Division. Arithmetic Operators. Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.

Week 2: Console I/O and Operators Gaddis: Chapter 3 (2.14,3.1-6,3.9-10,5.1) CS 1428 Fall 2014 Jill Seaman 1 2.14 Arithmetic Operators An operator is a symbol that tells the computer to perform specific

### Operators And Expressions

Operators And Expressions Operators Arithmetic Operators Relational and Logical Operators Special Operators Arithmetic Operators Operator Action Subtraction, also unary minus + Addition * Multiplication

### Introduction to C++ Introduction and History. Characteristics of C++

Introduction and History Introduction to C++ Until 1980, C programming was widely popular, and slowly people started realizing the drawbacks of this language and at the same time, the engineers had come

### CS113: Lecture 3. Topics: Variables. Data types. Arithmetic and Bitwise Operators. Order of Evaluation

CS113: Lecture 3 Topics: Variables Data types Arithmetic and Bitwise Operators Order of Evaluation 1 Variables Names of variables: Composed of letters, digits, and the underscore ( ) character. (NO spaces;

### Computer Programming CS F111

Computer Programming CS F111 BITS Pilani Dubai Campus NAND KUMAR Basics of C Programming BITS Pilani Dubai Campus Write a program that 1. Asks 5 marks from the user, find the average of the marks and print

### Prof. Navrati Saxena TA: Rochak Sachan

JAVA Prof. Navrati Saxena TA: Rochak Sachan Operators Operator Arithmetic Relational Logical Bitwise 1. Arithmetic Operators are used in mathematical expressions. S.N. 0 Operator Result 1. + Addition 6.

### Guide for The C Programming Language Chapter 1. Q1. Explain the structure of a C program Answer: Structure of the C program is shown below:

Q1. Explain the structure of a C program Structure of the C program is shown below: Preprocessor Directives Global Declarations Int main (void) Local Declarations Statements Other functions as required

### UNIT IV 2 MARKS. ( Word to PDF Converter - Unregistered ) FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING

( Word to PDF Converter - Unregistered ) http://www.word-to-pdf-converter.net FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING INTRODUCTION TO C UNIT IV Overview of C Constants, Variables and Data Types

### Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following g roups:

JAVA BASIC OPERATORS http://www.tuto rialspo int.co m/java/java_basic_o perato rs.htm Copyrig ht tutorialspoint.com Java provides a rich set of operators to manipulate variables. We can divide all the

### Operators. Java Primer Operators-1 Scott MacKenzie = 2. (b) (a)

Operators Representing and storing primitive data types is, of course, essential for any computer language. But, so, too, is the ability to perform operations on data. Java supports a comprehensive set

Prepared by: Shraddha Modi Introduction In looping, a sequence of statements are executed until some conditions for termination of the loop are satisfied. A program loop consist of two segments Body of

### Computers in Engineering. Moving From Fortran to C Michael A. Hawker

Computers in Engineering COMP 208 Moving From Fortran to C Michael A. Hawker Remember our first Fortran program? PROGRAM hello IMPLICIT NONE!This is my first program WRITE (*,*) "Hello, World!" END PROGRAM

CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting

### Department of Computer Applications

Sheikh Ul Alam Memorial Degree College Mr. Ovass Shafi. (Assistant Professor) C Language An Overview (History of C) C programming languages is the only programming language which falls under the category

### 2/5/2018. Expressions are Used to Perform Calculations. ECE 220: Computer Systems & Programming. Our Class Focuses on Four Types of Operator in C

University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Expressions and Operators in C (Partially a Review) Expressions are Used

### ENGI Introduction to Computer Programming M A Y 2 8, R E Z A S H A H I D I

ENGI 1020 - Introduction to Computer Programming M A Y 2 8, 2 0 1 0 R E Z A S H A H I D I Last class Last class we talked about the following topics: Constants Assignment statements Parameters and calling

### Information Science 1

Topics covered Information Science 1 Terms and concepts from Week 8 Simple calculations Documenting programs Simple Calcula,ons Expressions Arithmetic operators and arithmetic operator precedence Mixed-type

### JAVA Programming Fundamentals

Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

### Fundamentals of Programming CS-110. Lecture 3

Fundamentals of Programming CS-110 Lecture 3 Operators Operators Operators are words or symbols that cause a program to do something to variables. OPERATOR TYPES: Type Operators Usage Arithmetic + - *

### INTRODUCTION TO C A PRE-REQUISITE

This document can be downloaded from www.chetanahegde.in with most recent updates. 1 INTRODUCTION TO C A PRE-REQUISITE 1.1 ALGORITHMS Computer solves a problem based on a set of instructions provided to

### Chapter 7. Additional Control Structures

Chapter 7 Additional Control Structures 1 Chapter 7 Topics Switch Statement for Multi-Way Branching Do-While Statement for Looping For Statement for Looping Using break and continue Statements 2 Chapter

### Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite

### Work relative to other classes

Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language

### CT 229. Java Syntax 26/09/2006 CT229

CT 229 Java Syntax 26/09/2006 CT229 Lab Assignments Assignment Due Date: Oct 1 st Before submission make sure that the name of each.java file matches the name given in the assignment sheet!!!! Remember:

Sir Muhammad Naveed Arslan Ahmed Shaad (1163135 ) Muhammad Bilal ( 1163122 ) www.techo786.wordpress.com CHAPTER: 2 NOTES:- VARIABLES AND OPERATORS The given Questions can also be attempted as Long Questions.

### Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

### Flow Chart. The diagrammatic representation shows a solution to a given problem.

low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation

### UNIT IV INTRODUCTION TO C

UNIT IV INTRODUCTION TO C 1. OVERVIEW OF C C is portable, structured programming language. It is robust, fast.extensible. It is used for complex programs. The root of all modern language is ALGOL (1960).

### Programming in C++ 5. Integral data types

Programming in C++ 5. Integral data types! Introduction! Type int! Integer multiplication & division! Increment & decrement operators! Associativity & precedence of operators! Some common operators! Long

### ME 461 C review Session Fall 2009 S. Keres

ME 461 C review Session Fall 2009 S. Keres DISCLAIMER: These notes are in no way intended to be a complete reference for the C programming material you will need for the class. They are intended to help

### PESIT Bangalore South Campus Hosur Road (1km before Electronic City), Bengaluru Department of Basic Science and Humanities

SOLUTION OF CONTINUOUS INTERNAL EVALUATION TEST -1 Date : 27-02 2018 Marks:60 Subject & Code : Programming in C and Data Structures- 17PCD23 Name of faculty : Dr. J Surya Prasad/Mr. Naushad Basha Saudagar

### Declaration. Fundamental Data Types. Modifying the Basic Types. Basic Data Types. All variables must be declared before being used.

Declaration Fundamental Data Types All variables must be declared before being used. Tells compiler to set aside an appropriate amount of space in memory to hold a value. Enables the compiler to perform

### CSE 1001 Fundamentals of Software Development 1. Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018

CSE 1001 Fundamentals of Software Development 1 Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018 Identifiers, Variables and Data Types Reserved Words Identifiers in C Variables and Values

### Floating Point Arithmetic

Floating Point Arithmetic Computer Systems, Section 2.4 Abstraction Anything that is not an integer can be thought of as . e.g. 391.1356 Or can be thought of as + /