via operators and statements equivalent to some programming language

# Via operators and statements equivalent to some

• 28

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.
©LPU CSE101 C Programming Pseudo code: Add 2 Numbers Set A = 4. Set B = 2. Calculate Sum = A + B . Print Sum.
©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
©LPU CSE101 C Programming Flow Chart Symbols
©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…
©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
©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
©LPU CSE101 C Programming Structure of C program
©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..
©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
©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

#### You've reached the end of your free preview.

Want to read all 28 pages?

• Spring '18
• Aman

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern