via operators and statements equivalent to some programming language

Via operators and statements equivalent to some

This preview shows page 13 - 24 out of 28 pages.

via operators and statements equivalent to some programming language instructions. The only difference will be that the exact syntax of the programming language will not be followed.
Image of page 13
©LPU CSE101 C Programming Pseudo code: Add 2 Numbers Set A = 4. Set B = 2. Calculate Sum = A + B . Print Sum.
Image of page 14
©LPU CSE101 C Programming Flow Chart Flow Chart is pictorial representation of an algorithm. Whatever we have done in algorithm we can represent it in picture. It is easy to understand. Shows the flow of the instruction
Image of page 15
©LPU CSE101 C Programming Flow Chart Symbols
Image of page 16
©LPU CSE101 C Programming Flow Chart: Add 2 Numbers START TAKE TWO NUMBERS A and B FIND SUM=A+B PRINT SUM STOP Quick yak: Ask students to draw a fow chart for going to a movie…
Image of page 17
©LPU CSE101 C Programming Program in C: Add 2 Numbers #include<stdio.h> void main() { int a=4; int b= 2; int sum; sum=a+b; printf(“Sum is: %d”, sum); } Sum is: 6
Image of page 18
©LPU CSE101 C Programming Program in C #include<stdio.h> #include<conio.h> int main() { int pr_per_kg = 45; float no_of_kg = 7.5; float t_pr; t_pr = pr_per_kg * no_of_kg; printf(“%f”, t_pr); getch(); } 337.5
Image of page 19
©LPU CSE101 C Programming Structure of C program
Image of page 20
©LPU CSE101 C Programming Explanation A simple C program consists of Comments (optional) // /*….*/ Including header files #include<header file name> Functions main function as special function Other user defined functions (optional) Let’s discuss these in detail..
Image of page 21
©LPU CSE101 C Programming Comments Two forward slashes ‘ // ’ (double forward slashes), are used to write single line comment The next combination ‘ /*……..*/ ’ (forward slash with asterisk) is used for commenting multiple lines These comments are not being executed by compiler * comment can appear anywhere in a program where a white space can appear
Image of page 22
©LPU CSE101 C Programming Comments Enhances readability of program Fuel consumption: 16.0 L/100 km Fuel consumption: 16.0 L/100 km Carbon fiber engine bonnet Carbon fiber engine bonnet Front tyre: 255/35 ZR19 Front tyre: 255/35 ZR19 Real life example C code example //Prog. Name: addition of integers //Another format /*Prog. Name: addition of integers
Image of page 23
Image of page 24

You've reached the end of your free preview.

Want to read all 28 pages?

  • Spring '18
  • Aman

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors