KEMBAR78
Sample Report XII | PDF | Parameter (Computer Programming) | Function (Mathematics)
0% found this document useful (0 votes)
7 views15 pages

Sample Report XII

This lab report focuses on user-defined functions in C programming, specifically input and output functions like scanf() and printf(). It includes worked examples of various programming tasks, such as finding sums, determining even or odd numbers, and sorting strings. The conclusion reflects on the positive learning experience and the practical application of I/O functions in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views15 pages

Sample Report XII

This lab report focuses on user-defined functions in C programming, specifically input and output functions like scanf() and printf(). It includes worked examples of various programming tasks, such as finding sums, determining even or odd numbers, and sorting strings. The conclusion reflects on the positive learning experience and the practical application of I/O functions in programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

TRINITY INTERNATIONAL SS & COLLEGE

Lab Report on C programming

(COMPUTER SCIENCE-4281)

SUBMITTED BY: SUBMITTED TO:


Darshan Adhikari Dayaram Yadav

GRADE: XII ‘MA2'


REGISTRATION NUMBER:

KATHMANDU, NEPAL

2025
TRINITY INTERNATIONAL SS & COLLEGE

Lab sheet #1
(User Defined Functions)

Lab date:- 2082/3/15


Submission date:- 2082/3/27

Internal signature External Signature


Objectives

The objective of a program using input and output functions is to know about
different input and output functions and their use in different programs. It will
help us to be familiar with some frequently used I/O functions like
scanf(),printf(), gets(),puts, putchar() ,getchar() etc. Having used functions, we
will be able to input and output numerical and string related data easily

i
THEORY
Input/Output(I/O) Functions:
C language consists of some I/O functions like getchar(), putchar(), gets(),
puts() which are also defined inside stdio.h header file. The printf() and scanf()
functions are known as formatted I/O functions because they can take any type
of format of data from the I/O devices.
Syntax:
printf( "control string", arg1, arg2, ......);
Here control string may consist of any simple characters or format
conversion specifiers or escape sequences and arg1, arg2,.... are
arguments (variables) that represent the individual data item.
Example1:

printf(“Hello”);

ii
Table of Contents
Objectives i
THEORY ii
Input/Output(I/O) Functions: ii
Table of Contents 3
Worked out examples 1
1. WAP to find sum of two numbers using function named sum(). 1
2. WAP to know a number is even or odd using function named
evenodd(). 2
3. WAP to print the greatest value among three numbers using a
function int great(). We have to use return statement. 3
4. WAP to know a number is prime or composite using function. 4
5. WAP to find sum of series 1, 2, 3,…..200 using function. 5
6. WAP to input elements of an array and print them with their sum. 6
7. Suppose a function void matrix_sum(int a[][],int b[][]).Here, we have
passed array as parameter. Use this function to find sum of matrices.
7
8. WAP to sort ‘n’ number of strings using function. Pass strings as
parameter. 8
9. WAP to find factorial value of a number using recursive function. 9
Conclusion 10
Worked out examples
1. WAP to find sum of two numbers using function named sum().

1
2. WAP to know a number is even or odd using function named
evenodd().

2
3. WAP to print the greatest value among three numbers using a function
int great(). We have to use return statement.

3
4. WAP to know a number is prime or composite using function.

4
5. WAP to find sum of series 1, 2, 3,…..200 using function.
Assume yourself function name. It returns an integer value.

5
6. WAP to input elements of an array and print them with their sum.
Suppose, the array is one dimensional and is of void type and
function to be used is array_elements().

6
7. Suppose a function void matrix_sum(int a[][],int b[][]).Here, we have
passed array as parameter. Use this function to find sum of matrices.

7
8. WAP to sort ‘n’ number of strings using function. Pass strings as
parameter.

8
9. WAP to find factorial value of a number using recursive function.

9
Conclusion

It was a wonderful time in the lab and classroom while learning. The outcome
of the learning is great and is very similar to the prediction made in the
beginning. We learned about input and output functions in detail. It helped us
a lot in our programming. We came to know its syntax, semantic with example.
I hope that this will help us in future in my project work. At last, I would like
to thank my class subject teacher for his support and cooperation.

10

You might also like