Knowledge in Basic c programming

C PROGRAMMING AND SYSTEM

It contains notes for Engineering C PROGRAMMING AND SYSTEM

Basic C Programming

In this Document the basics for the BCA students, C programming has been discussed with various examples.

Steps for problem solving.

We have 8 main steps for solving the problem. 1.defining the problem. 2. Designing the problem 3. Coding the program 4. Testing and debugging the program. 5. Syntax errors. 6. Logic errors. 7. Run time errors. 8. Maintaining and upgrading the program.

Flow chart description and example of flow chart.

Flow chart is the pictorial representation of an algorithm to solve the problem.they are very much useful in documentation of a program . There are few symbols that represents a specific activity of that symbol. This flow chart helps in detail clarification of a program logic.

Program to explain type casting.

Type casting means changing of one data type into other. type casting is of two types implicit and explicit. Implicit means the compiler will automatically converts the data type into other. Explicit means we have to mention the data type it wanted to be changed in.

Program to explain simple if.

Simple if is used to check a simple condition like yes or no . Let us introduce two variables a,b . If a is greater than b then a is greatest. This is the format of simple if condition. It includes two header file studio.h and conio.h to include all the files that we include in a program.

Program to explain if-else condition that is to find the maximum between two numbers.

If else condition is used to check the condition if a is greater than b then a is greatest otherwise b is greatest.. if(a>b) Printf(.....); Else Printf(.....); This is the syntax of if else condition.

Program to perform if else if ladder performing average of 3numbers.

If else if ladder is used to check more than 3 conditions it means multiple conditions in a single program. Here I considered m1,m2,m3,tot ,avg as variables of data type integer. First perform total then average . Finally checking the conditions by some range is to be performed.

Program to explain switch case which has case blocks without statements.

Here switch case is used to test the value of a variable and compares it with multiple cases. If one case is found matched then the statement of that particular case is executed . Switch contain many cases inside the block . Likr case2,case2,case3,case4,....multiple cases .for every case break statement is used to exit the loop.

Program to explain sum of even numbers beloow range n.

Here is a program to explain sum of even numbers in a given range n . This program is written using do while. Initially consider a number num, and sum=0 . While (num

Program to explain soul of odd numbers in a given range.

Here in odd case num should be initialized with 1 ,num=1. And sum=0. This is also written using do while .