Getting Started
Getting Started
CHARACTER SET
ASCII TABLE
PROBLEM SET
Write a C program which will display your name
Write a C program which will show all of your
address in multiple lines.
Write a C program which would give a output
like below.
Is
it convenient?
DIFFERENCES BETWEEN
VARIABLES & CONSTANTS
DATA TYPES
(1 byte or 8 bits)
Integer (2 byte or 16 bits)
Real
Float (4 byte or 32 bits)
Double (8 byte or 64 bits)
Example:
char ch;
int num1;
float f1_num;
double _dnum;
Decimal to Binary
10 = 1010
M = 77 = 1001101
Name
Sign
Character
%c
Integer
%d
Floating Point
%f
Double
%lf
EXAMPLE
WHERE WE ARE
INSTRUCTIONS
ARITHMETIC INSTRUCTIONS
ARITHMETIC INSTRUCTIONS:
POINTS TO REMEMBER
C allows only one variable on left-hand side of =.
That is, z = k * l is legal, whereas k * l = z is
illegal.
In addition to the division operator C also
provides a modular division operator (%).
Arithmetic operations can be performed on ints,
floats and chars.
char x, y; int z ; x = 'a' ; y = 'b' ; z = x + y ;
No operator is assumed to be present.
a = c.d.b(xy) usual arithmetic statement
b = c * d * b * ( x * y ) C statement
ARITHMETIC INSTRUCTIONS:
INTEGER AND FLOAT CONVERSION
An arithmetic operation between an integer and
integer always yields an integer result.
An operation between a real and real always yields a
real result.
An operation between an integer and real always
yields a real result.
HIERARCHY OF OPERATORS
i=2*3/4+4/4+8-2+5/8
i = 6 / 4 + 4 / 4 + 8 - 2 + 5 / 8
i = 1 + 4 / 4 + 8 - 2 + 5 / 8
i = 1 + 1+ 8 - 2 + 5 / 8
i = 1 + 1 + 8 - 2 + 0
i = 2 + 8 - 2 + 0
i = 10 - 2 + 0
i = 8 + 0
i = 8
EXAMPLE SET
Example: Find the area of a Circle of radius r.
Step1:
START
Step2: Read R
Step3: Area PI*r*r //
calculation of area
Step4: Print Area
Step5: END
EXAMPLE SET
Algorithm:
Step1: Start
Step6: End
PROBLEM SET
Find out the summation of three numbers.
Write a C program which is going to convert Celsius
into Fahrenheit. (Fahrenheit = (9.0 / 5.0) * Celsius +
32.0)
Rameshs basic salary is input through the keyboard.
His dearness allowance is 40% of basic salary, and
house rent allowance is 20% of basic salary. Write a
program to calculate his gross salary.
If the marks obtained by a student in five different
subjects are input through the keyboard, find out the
aggregate (sum) marks and percentage marks obtained
by the student. Assume that the maximum marks that
can be obtained by a student in each subject is 100.
The End