Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 8

Lecture 4

Revision
 Programming
 Why programming
 Programming language
 Compiler
 Variable
 Data types of variables
 Printf Statement
 Assignment operator
Syntax for C

Semicolon at end of each line other wise


Syntax error
Declaration of variable necessary before its use
Keywords in C

 Pre-defined words that have speceial meaning. These


words cant be used as variables names.
 E.G. int , char, printf, float
printf
printf(“hello world”)
Printing an integer on screen
printf(“%d”, variable whose value to be printed);
Printing float on screen
printf(“%f”, variable whose value to be printed);
Printing character on screen
printf(“%c”, variable whose value to be printed);
Input
 scanf
 scanf(“%d”, &variable in which value to be placed)
Make a program that takes two numbers as
input and returns their sum

You might also like