SAGE University, Indore
Institute of Engineering &
Technology
Department of Computer Science & Engineering
Laboratory Manual
Course Type- Practical
Academic Session: July-Dec 2024
Program : BTech CSE- 1 Year
Course Code : ECSDCDSA001T
Course Name : Data structure & algorithms lab
Faculty HOD HOI
Name :Prof.Aishwarya patidar Name : Dr. Deepak K Yadav Name : Dr.Lalji Prasad
Signature : Signature : Signature :
Table of Contents
Experiment
S.No. Title of Experiment Page No.
Number
Program to input marks of 5 subjects and print the total and
1 1
%using array.
2 2 Program to find highest & lowest element in an array.
3 3 Program to find the sum of even and odd elements in an array.
4 4 Program to find read two 3*3 matrices and add them.
5 5 Program to multiply two matrices.
6 6 Program to find the factorial of a number using recursion.
7 7 Program to generate the Fibonacci series using recursion.
Program to perform the following string operation.
A) Find length of entered string.
8 8 B) Concatenate two stringsz
C) Copy one string to another
D) Compare two strings.
9 9 Program to implement Linear search.
10 10 Program to implement Binary search.
11 11 Program to implement insertion sort.
12 12 Program to implement selection sort.
Experiment
1
Number
Experiment Title Program to input marks of 5 subjects and print the total and %using array.
Course Outcome
CO1. To understand the basic concepts array data structure.
(CO)
Tools/Apparatus Hardware Computer System with 2GB RAM and Hard Disk storage
C++ complier
Required Software Visual studio code
This experiment will be used to explain how to declare array and how to
Experiment
insert element in array. User will take inputs and sum and average will be
Description calculated using fxns.
#include <iostream>
using namespace std;
int main()
{
cout<<"name:"<<="Aishwarya patidar\n";
cout<<"eno:"<<"12233";
//initialize an array that will store marks of 5 subjects
int marks[5];
int i;
float total=0,avg;
//ask user to enter the marks for individual subject
cout<<"Enter math marks: "; cin>>marks[0];
cout<<"Enter physics marks: "; cin>>marks[1];
Experiment cout<<"Enter chemistry marks: "; cin>>marks[2];
Code/Procedure
cout<<"Enter english marks: "; cin>>marks[3];
cout<<"Enter cs marks: " ; cin>>marks[4];
//calculate the total marks
for(i=0; i<5; i++)
{
total+=marks[i];
}
//compute the average of 5 subjects
avg = total/5;
cout<<"The average marks you got is: "<<avg;
return 0;
}
Input Enter math marks: 98
Enter physics marks: 97
Enter chemistry marks: 96
Enter english marks: 95
Enter cs marks: 94
Like: output windows screenshot
Output/Result It is compulsory to print your name and enrollment no. In all program
output screen with screenshot.