2. WHAT IS A PROGRAMMING LANGUAGE?
Coded language used by programmers to
write instructions that a computer can
understand to do what the programmer
3. HISTORY OF PROGRAMMING LANGUAGE
1954 - FORTRAN ("Formula Translation“)
Hello , World!
Source code Output
is a general-purpose, imperative programming language that is
especially suited to numeric computation and scientific computing.
4. 1970 - Pascal
a high-level structured computer programming language
used for teaching and general programming.
Hello World
Source code Output
5. 1983 - C++
Source code
Hello World
Output
is a general-purpose programming language. It has imperative,
object-oriented and generic programming features, while also
providing facilities for low-level memory manipulation.
6. C - 1978
is a powerful general-purpose programming
language. It is fast, portable and available in all
platforms.
Hello World
Source code
Output
7. 1991 – Java
Source code
Hello , World
Output
a general-purpose computer programming language designed to
produce programs that will run on any computer system.
8. THERE ARE THREE MAIN KINDS OF
PROGRAMMING LANGUAGE:
Machine language.
Assembly language.
High-level language.
9. C PROGRAMMING LANGUAGE
Input output Libraries
Header File
#include<stdio.h>
Functions
Printf()
Scanf()
#include<conio.h>
Functions
Getch()
Textcolor()
Textbackground()
10. Main()
{
//Data types Declaration
Type
Keyword
Boolean = Bool
Integer = int
Floating point = float
Character =
char
//Variables Declaration
Variables are part of almost every program
A variable is a “place to put data” and is
usually represented by a letter or a word.
11. EXAMPLE 1 – A SIMPLE PAYROLL PROGRAM
A Simple Payroll Program
Output
Name:
Basic
Pay:Tax :
Net
Pay:
Joemarie
5,000
500
4,500
12. THE CORRESPONDING C PROGRAM
#include<stdio.h>
#include<conio.h>
main()
{
// Data Types and Variable Declaration
char name;
int basicpay,tax,netpay;
printf("A Simple Payroll Programn");
printf("Name:");scanf("%s",&name);
printf(" basicpay :");scanf("%d",&basicpay);
printf("Tax:");scanf("%d",&tax);
// formula
netpay=basicpay-tax;
printf("Net Pay: %d",netpay);
getch();
}
13. Example 2 – A simple Payroll Program using If
Statement
A Simple Payroll Program
Name:
Basic Pay:
Tax :
Net
Pay:
Key in Employee's Data
Employee's
Code:
Joemarie
a
5,000
500
4,500
14. THE CORRESPONDING C PROGRAM USING IF STATEMENT
#include<stdio.h>
#include<conio.h>
main()
{
// Data Tpyes and Variable Declaration
char name;
char empcode;
int basicpay,tax,netpay;
printf(" A Simple Payroll Programn");
printf(" Key in Employee's Datan");
printf("Name:");scanf("%s",&name);
printf("Employee's Code:");scanf("%s",&empcode);
if(empcode=='a')
basicpay=5000;
else if(empcode=='b')
basicpay=6000;
else if(empcode=='c')
basicpay=7000;
else if(empcode=='d')
basicpay=8000;
else if(empcode=='e')
basicpay=9000;
printf("Basic Pay: %d",basicpay);
printf("n");
printf("Tax:");scanf("%d",&tax);
// formula
netpay=basicpay-tax;
printf("Net Pay: %d",netpay);
getch();
}
15. LOGICAL ERROR
is a mistake in a program's source code that results in
incorrect or unexpected behavior.
It is a type of runtime error that may simply produce the
wrong output or may cause a program to crash while
running
SYNTAX ERROR
A syntax error is an error in the source code
of a program.