1 Programming Fundamentals
1 Programming Fundamentals
Fundamentals
Note: The only sign of a logic error may be incorrect program output.
int main(void){
local declarations
statements
}
int main(void) {
printf("Hello World!\n");
return 0;
}
2. define
Syntax:
data type variable_list;
Examples:
int x,age;
float sum,a,b;
char middle_intial;
Prepared by: Dr. Cheryl B. Pantaleon
Fundamentals of Programming
Data Type
• Defines the size and set of values and a set of operations that can be
performed on those values.
Example:
int Count;
Count = 5;
Example:
float Miles;
Miles = 5.6;
Example:
double Atoms;
Atoms = 2500000.13;
Example:
char Letter;
Letter = 'x';
Syntax:
printf(“string expression”);
printf(“format code”,var_name);
Examples:
printf(“Hello world”);
printf(“%d”,x);