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

Rajshahi University of Engineering & Technology Department of Mechatronics Engineering

The document provides instructions for exercises on functions and pointers in C programming. It includes 9 exercises: 1) swapping two numbers using call by value, 2) swapping two numbers using call by reference, 3) converting a decimal number to binary using a function, 4) checking if two strings are anagrams, 5) multiplying two matrices using pointers, 6) sorting an array using pointers, 7) finding the greatest common divisor of two numbers using a function, 8) finding the lowest common multiple of two numbers using recursion, and 9) calculating the standard deviation of a population using a function.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Rajshahi University of Engineering & Technology Department of Mechatronics Engineering

The document provides instructions for exercises on functions and pointers in C programming. It includes 9 exercises: 1) swapping two numbers using call by value, 2) swapping two numbers using call by reference, 3) converting a decimal number to binary using a function, 4) checking if two strings are anagrams, 5) multiplying two matrices using pointers, 6) sorting an array using pointers, 7) finding the greatest common divisor of two numbers using a function, 8) finding the lowest common multiple of two numbers using recursion, and 9) calculating the standard deviation of a population using a function.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Heaven’s Light is Our Guide

Rajshahi University of Engineering & Technology


Department of Mechatronics Engineering

Course No.: CSE 1288


Course Title: Computer Fundamentals & Programming Sessional
Credit: 3.00
Lecture: 3.00 Hr/Week
Lab Manual developed by: Md. Mehedi Hasan

Lecture 6: Function & Pointer

Exercises: Write algorithm, draw flowchart and C code for the following problems
1. Write a program in C to swap two numbers using function. Use call by value.
Input:
10 20
Output:
20 10
2. Write a program in C to swap two numbers using function. Use call by reference.
3. Write a program in C to convert decimal number to binary number using the function.
Input:
65
Output:
1000001
4. Write a program in C to check whether two given strings are an anagram
Input:
spare pears
Output:
yes
5. Write a C program to multiply two matrix-using pointers.
Input:
10 20 30
40 50 60
70 80 90
123
456
789
Output:
300 360 420
660 810 960
1020 1260 1500

6. Write a C program to input elements in an array and sort array using pointers
Input:
10 -1 0 4 2 100 15 20 24 -5
Output:
-5, -1, 0, 2, 4, 10, 15, 20, 24, 100,
100, 24, 20, 15, 10, 4, 2, 0, -1, -5,
7. Write a function in C to find GCD (Greatest Common Divisor) of two numbers.
Input:
10 15
Output:
5
8. Write a C program to find LCM of two numbers using recursion.
Input:
12 30
Output:
60
9. Write a function to calculate standard deviation of population.
Input:
10
1 2 3 4 5 6 7 8 9 10
Output:
2.872281

You might also like