CS1100
Computational Engineering
Structures
Jayalal Sarma
and
Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Structures
Collection of one or more variables, possibly of
different types, grouped together under a single
name for easy h

CS1100 Lab Schedule
Jan-May 2014
Day-wise roll list
Day
Monday
(83)
AE
AE13B001
AE13B058
BE
BS
BE13B001
BR13B022
CE
ME
NA
Backlog
Students
AE12B053
Tuesday
(83)
BE13B023
BE13B033
BS13B001 CE13B001
BS13B032 CE13B047
Wednesd
ay
(83)
CE13B048
CE13B097
ME1

CS110
Computational Engineering
An Introduction to
Problem Solving using Computers
V. Kamakoti
Course Material P.Sreenivasa Kumar, N.S.Narayanaswamy, Deepak Khemani, V. Kamakoti CS&E, IIT M1
Common uses of a Computer
As a tool for storing and retrieving

Number representation
With two decimal digits suppose we add one
repeatedly starting with 00
00, 01, 02, ., 99 and then 100,
but as we have only two digits the 1 will be lost leading
to 00
So the sequence will be
00,01,02,98,99,00,01,02,.
It is cycl

Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Typecasting
(Clarification Slide)
Mixed Typed Expressions
Let a be an float variable.
a=12/5 ?
a=12.0/5 ?
a=12/5.0 ?
a=12.0/5.0 ?
Type Casting
A way to convert a variable from one data type
to anothe

CS1100
Computational Engineering
Searching and Structures
Instructors :
Jayalal Sarma
And
Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Searching for Elements
Given an array of marks and names, is there
someone who got X marks?
If

CS1100
Computational Engineering
Control Structures
Kamakoti V.
and
Jayalal Sarma
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Perfect Number Detection
Perfect number sum of proper divisors adds up to
the number
Pseudocode:
Read a number, A

CS1100
Computational Engineering
Selection Statements
Jayalal Sarma M.N
and
Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Decisions with Variables
Need for taking logical decisions during
problem solving
If b^2 4ac negative, we sho

CS1100
Computational Engineering
Functions
Kamakoti V.
and
Jayalal Sarma M.N.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Functions = Outsourcing
Break large computing tasks into small ones
Helps you to build on what others have done
You an

Name:
0
Roll No:
1
2
3
4
5
Total
Department of Computer Science and Engineering
Indian Institute of Technology Madras
CS1100: Computational Engineering
Quiz 1
March 2011, 8:00-8:50 a.m.
Answer all questions. No calculators or cellphones.
0) Julian Assange

CS1100
Computational Engineering
Numerical Methods
Madhu Mutyam
and
Sukendu Das
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Numerical Methods
Used for:
Solution of algebraic equations
Approximation of functions
Differentiation and integrat

CS1100
Computational Engineering
Multi-Dimensional Arrays
Instructors :
Jayalal Sarma
And
Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Multi-dimensional Arrays
char multi[4][10];
multi[4] an array of ten characters
4 such arrays

CS1100
Computational Engineering
Summary
Madhu Mutyam
and
Sukendu Das
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Exercises
Write a program that reads in a five-digit integer
and determines whether or not it is a palindrome.
Input an integer

CS1100
Computational Engineering
An Introduction to solving problems using Computers
Tutors:
Shailesh Vaya
vaya@cse.iitm.ac.in
PSK, NSN, DK, TAG CS&E, IIT M
Anurag Mittal
amittal@cse.iitm.ac.in
1
Course Outline
Introduction to Computing
Programming in C

CS1100
Computational Engineering
File I/O
Madhu Mutyam
and
Sukendu Das
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Homework Problems on Arrays and Strings
Given a square array of integers produce an array
rotated clockwise by 90o.
Convert a

CS1100
Computational Engineering
Searching and Structures
Madhu Mutyam
and
Sukendu Das
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Searching for Elements
Given an array of marks and names, is there
someone who got X marks?
If X occurs in the

CS1100
Computational Engineering
String Sorting and Pointers
Jayalal Sarma
and
Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Lexicographic (Dictionary) Ordering
Badri < Devendra
Janak < Janaki
Shiva < Shivendra
Seeta < Sita
Base

CS1100
Computational Engineering
Matrix Operations
Kamakoti V.
and
Jayalal Sarma M.N.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Multi-Dimensional Arrays
Arrays with two or more dimensions can be
defined
A[4][3]
0
1
2
0
0
0
1
1
2
2
3
3
1
0
S

CS1100
Computational Engineering
Arrays
Jayalal Sarma M.N.
and
Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
An Array
A data structure containing items of same data type
Declaration: array name, storage reservation
int marks[7] =

CS1100
Computational Engineering
An Introduction to
Problem Solving using Computers
Jayalal Sarma M.N. and Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
*
Course Outline
Introduction to Computing
Programming (in C)
Exercises and exa

CS1100
Computational Engineering
Recursion and Sorting
Kamakoti V.
and
Jayalal Sarma M.N.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Factorial (n) Recursive Program
fact(n) = n*fact(n-1)
int fact (int n)cfw_
if (n = 1) return 1;
return n*fact

CS1100
Computational Engineering
Pointers
Instructors :
Jayalal Sarma
And
Kamakoti V.
Course Material SD, SB, PSK, NSN, DK, TAG CS&E, IIT M
1
Accessing Arrays with Pointers
#include <stdio.h>
int myArray[ ] = cfw_1,24,17,4,-5,100;
int *ptr;
int main(void)

@8110: Introduction to Computing
Quiz - I
Feb. 141 2308
Total Duration: 5i) Minutes ' Maximm Marks: 25
Roll Number:
_—_.—._.———-—-—-—-—-—-—'—‘
Instructions
a Please ﬁll in ur roll number in the .apeae provided above before reading the.
following instructi