How to write C program
- Write down the header file (stdio.h, string.h, math.h, stdlib.h)
- Write main() functions
- Variable declaration
- 1st Data Type Selection
- Selecting suitable varaible name
- Ask for values - printf(output) , scanf(input)
- Perform the task (process)
- Display the result (printf)
Header file - stdio.h
- Number, Registration Number, Employee ID, Student ID , Marks obtained in exam (Whole Number)
- int %d
- area of circle, value of π=3.14
- float %f
- Simple if statement
- One condition and one statement for true . It works with goto statement
- if -else statement
- One condition - two statement each one for true and false Example: Odd/ Even , Prime/ Composite Detection
- if else if statement
- Two or more than two conditions Example: Grading System, Awarding Division based on percentage
- nested if else
- If we have to check one condition and within it another condition like nest ; Example : Division will be only awarded to the pass student.
Data Type Selection