0% found this document useful (0 votes)
3 views

Exercise 6 Programs on functions

The document outlines an experiment focused on understanding derived data types, pointers, and functions in C programming, specifically through calculating the factorial of a number using recursion. It includes an algorithm for the factorial function and several exercises that involve creating various programs using user-defined functions and recursion. The learning outcomes emphasize practical programming skills in C, including arithmetic operations, Fibonacci series generation, and number manipulation.

Uploaded by

labtophone
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)
3 views

Exercise 6 Programs on functions

The document outlines an experiment focused on understanding derived data types, pointers, and functions in C programming, specifically through calculating the factorial of a number using recursion. It includes an algorithm for the factorial function and several exercises that involve creating various programs using user-defined functions and recursion. The learning outcomes emphasize practical programming skills in C, including arithmetic operations, Fibonacci series generation, and number manipulation.

Uploaded by

labtophone
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/ 2

Experiment - 6:

DATE:
CO2: Comprehend the derived data types, pointers and creation of functions.
A. Aim :
Functions : Write a program to calculate factorial of a number using recursion.

B. Algorithm:
1. Start
2. For positive values of n, let's write n! as we did before, as a product of numbers starting
from n and going down to 1: n! = n.(n-1)….2.1
3. But notice that n! = n.(n-1)….2.1 is another way of writing (n-1)! , and so we can say
that n! = n.(n-1)….2.1.
4. Stop

C. C language Program

1|Page Win 24-25: course handled by M.A Inayathullaah


D. Output window

E. Learning Outcome:

F. Exercise-6:

6.1 Write a program to add, subtract, multiply and divide two integers using user-defined
type function with return type.
6.2 Write a program to calculate sum of first 20 natural numbers using recursive function.
6.3 Write a program to generate Fibonacci series using recursive function.
6.4 Write a program to swap two integers using call by value and call by reference methods
of passing arguments to a function.
6.5 Write a program to find sum of digits of the number using Recursive Function.
6.6 Write a program to read an integer number and print the reverse of that number using
recursion.
6.7 Write a C program to find maximum and minimum between two numbers using
functions.
6.8 Write a C program to check whether a number is even or odd using functions.
6.9 Write a C program to check whether a number is prime, Armstrong or perfect number
using functions.
6.10 Write a C program to find power of any number using recursion.

Pre Lab Marks (2-mark Max) In Lab Marks (3-mark Max) Post Lab Marks (5-mark Max)

2|Page Win 24-25: course handled by M.A Inayathullaah

You might also like