5
Lectures on Structured Programming language Swakkhar Shatabda

Lectures SPL

Embed Size (px)

DESCRIPTION

Cbanglalanguage

Citation preview

  • Lectures on Structured Programming language

    Swakkhar Shatabda

  • Chapter 1

    Introduction to CProgramming

    1

  • Chapter 2

    The printf () Function

    In this lecture, we will learn more about the printf() function in C.

    2

  • Chapter 3

    The Operators in C

    In this lecture, we will try to use C programs as calculators. We are interestedin arithmetic operations. These operations include the following:

    1. Addition / Plus ( Example: 10+2, 2.57-5.67 )

    2. Subtraction / Minus ( Example 30-3, 45.89-34.3)

    3. Multiplication (10*3, 2.3*4.0)

    4. Division (10/2, 15.0/4.0)

    These operators have a general form. Each operator (+,, , /) has twooperands in each side and the operator sign is in the middle. They take twooperands. They are called binary operators since they take only two operands.The operands are generally numbers. There are two types of numbers in C:whole numbers, which we call integers. They do not have any fractional parts.Example: 0, 1,3. There are other types of numbers with fractional parts. Wecall them floating point numbers. An operator along with its operands forman arithmetic expression. An operator working on a number also gives us anumber. For example, 3 + 2 yields 5. Now in C, we wish to perform suchoperations and print the value of such expressions in the console using printf()function. How can we do that?

    3.1 Format Specifier

    In this section, we will learn about the format specifiers in C that helps us toprint any number in the screen or console. Consider the following program:

    #include

    int main()

    {

    3

  • printf("3+2");

    return 0;

    }

    4