Skip to content

Functions

Function is a small program or piece of code that is already defined to use later.
functions in c language can appear in two forms:
1. definition form
2. invocation form
Two types of functions
1. pre-defined  Eg: printf(), scanf() etc.
2. user defined
Output Statement
Output is the activity that is displaying response or result from C program to the user.
printf() function will be used to display output.
syntax1 of printf():
printf(“message to be printed”);
Escape Characters
special characters followed by \ sign that changes the way of output of printf.
\n – new line
\t – horizontal tab
\v – vertical tab
\” – prints “
\\ – prints \
%% – prints %

Exercises)
1. Write C Program to display your address like below:
Your Name,
S/o Father Name,
D.No. xx-xxx,
City Name,
State,
Pin: xxx xxx
Ph: +91-xxxx xxxx

2. Write C program to display the following Output:
1 x 2 = 2
2 x 2 = 4
3 x 2 = 6
4 x 2 = 8
5 x 2 = 10

3. Write C program to display the following output:
********************************************
MARKS LIST
********************************************
Sub1 : 91
Sub2 : 92
Sub3 : 93
********************************************
Total : 276
********************************************