Daa Lab Man
Daa Lab Man
RECURSIVE ALGORITHM
A recursive algorithm is a method of solving a problem by breaking it down into
smaller and smaller sub problems until the problem becomes simple enough to be
solved directly. In a recursive algorithm, a function calls itself in order to solve a
problem. The function will have a base case, which is a condition that stops the
recursion, and a recursive case, which is when the function calls itself with a simpler
version of the problem.
For example, the factorial function can be computed recursively by calling itself with
the input decremented by one until the input is one, at which point it returns one.
NON-RECURSIVE ALGORITHM
A non-recursive algorithm, also known as an iterative algorithm, solves a problem
without using recursion. Instead, it uses a looping construct such as a ‘for’ or ‘while’
loop to repeatedly perform a set of instructions until a certain condition is met. Non-
recursive algorithms can be more efficient in terms of memory and time complexity
than recursive algorithms. They are also easier to reason about for certain types of
problems. An example of non-recursive algorithm is a linear search algorithm in which
we iterate through an array and compare each element with the target value, until we
find the target value or end of array.
ORDER OF GROWTH
The order of growth is a way to express the performance of an algorithm in terms of
the size of the input. The order of growth is often represented using big O notation,
which describes the upper bound on the number of operations an algorithm takes to
solve a problem of size n.
O (log2 n) represents logarithmic time complexity
O (n) represents linear time complexity
In general, logarithmic time complexity (O(log 2n)) is considered more efficient than
linear time complexity (O(n)), as the input size increases, the logarithmic algorithm
will take fewer operations to solve the problem. However, there are other complexities
such as
O (n log2 n) which are considered to be more efficient than O(n) and less efficient than
O (log2 n).
AIM:
To write a C Program to find the GCD of given two positive integers.
ALGORITHM:
STEP 1: Start the Program.
STEP 2: Declare the required variables.
STEP 3: Read the value for num1 and num2.
STEP 4: Using for loop find a value which divides both num1 and num2.
STEP 5: Print the GCD of num1 and num2.
STEP 6: Stop the program.
ALGORITHM:
STEP 1: Start the Program.
STEP 2: Declare the required variables.
STEP 3: Read the value for num1 and num2.
STEP 4: Call the function Gcd().
STEP 5: Check is Num1 is 0 then return Num2 as Gcd to Main().
STEP 6: Check is Num2 is 0 then return Num1 as Gcd to Main().
STEP 7: Otherwise, make a recursive call to Gcd() as follows.
a. If Num1 > Num2 then call Gcd() with Num1%Num2 , Num2 as arguments.
b. If Num2 > Num1 then call Gcd() with Num1, Num2%Num1 as arguments.
STEP 8: Pass the GCD of Num1 and Num2 to Main().
STEP 9: Print the GCD of two numbers.
STEP 10: Stop the Program.
RESULT:
Thus, the program was executed successfully and the output was verified.
2
Ex.NO: 1 IMPLEMENTION OF RECURSIVE AND NON – RECURSIVE ALGORITHMS
b) FACTORIAL
AIM:
To write a C Program to find Factorial of a given number.
ALGORITHM:
STEP 1: Start the program.
STEP 2: Declare the required variables and Initialize fact as 1.
STEP 3: Read a number into Num.
STEP 4: Using for loop calculate factorial of the given number.
STEP 5: Calculate fact=fact*i until i <= Num.
STEP 6: Print the factorial of the given number.
STEP 7: Stop the Program.
PROGRAM (without recursion):
#include<stdio.h>
void main()
{
int fact=1,i,num;
printf("Enter the Number to Find Factorial :");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
fact=fact*i;
}
printf("Factorial of %d is %d",num,fact);
}
ALGORITHM:
STEP 1: Start the Program.
STEP 2: Declare the required variables.
STEP 3: Read the value for N
STEP 4: Call Fact() with N as argument.
STEP 5: If N=0 then return 1 as factorial.
STEP 6: Otherwise, call Fact() with N-1 as argument.
STEP 7: Finally return the factorial to the Main().
STEP 8: Print the Factorial in Main().
STEP 9: Stop the Program.
PROGRAM (with recursion):
#include<stdio.h>
int fact(int);
int main()
{ int x,n;
printf(" Enter the Number to Find Factorial :");
scanf("%d",&n);
x=fact(n);
printf(" Factorial of %d is %d",n,x);
return 0;
}
int fact(int n)
{
if(n==0)
return(1);
return(n*fact(n-1));
}RESULT:
3
Thus, the program was executed successfully and the output was verified.
Ex.NO:1 IMPLEMENTION OF RECURSIVE AND NON – RECURSIVE ALGORITHMS
c) FIBONACCI SERIES
AIM:
To write a C Program to display the Fibonacci Series.
ALGORITHM:
STEP 1: Start the Program.
STEP 2: Declare the required variables.
STEP 3: Initialize f=0, f1=0, f2=1, i=1.
STEP 3: Read the value for n.
STEP 4: Using do while loop find the Fibonacci Series.
STEP 5: In each iteration, print a term in Fibonacci Series. i.e., Print f.
STEP 6: Calculate f=f1+f2
STEP 7: Assign f2=f1; f1=f; i=i+1.
STEP 8: Repeat the Steps 5 to 7 until i<=n.
STEP 9: Display the Series.
STEP 10: Stop the Program.
PROGRAM (without recursion):
#include<stdio.h>
void main()
{
int i=1,n,f,f1,f2;
printf("Enter the number of elements: ");
scanf("%d",&n);
f=0;
f1=0;
f2=1;
printf("Fibonacci series:\n");
do
{
i++;
printf("%d\n",f);
f=f1+f2;
f2=f1;
f1=f;
}while(i<=n);
}
ALGORITHM:
STEP 1: Start the Program.
STEP 2: Declare the required variables.
STEP 3: Read the value for N.
STEP 4: Initialize a loop counter variable C=1 and execute a for loop.
STEP 5: Call recursive function Fibonacci().
STEP 6: Print all the terms of Fibonacci Series until C<=N
STEP 7: Stop the Program.
PROGRAM (with recursion):
#include<stdio.h>
int Fibonacci(int);
int main()
{
int n, i = 0, c;
` printf("Enter the number of elements: ");
scanf("%d",&n);
4
printf("Fibonacci series:\n");
for ( c = 1 ; c <= n ; c++ )
{
printf("%d\n", Fibonacci(i));
i++;
}
return 0;
}
int Fibonacci(int n)
{
if ( n == 0 )
return 0;
else if ( n == 1 )
return 1;
else
return ( Fibonacci(n-1) + Fibonacci(n-2) );
}
RESULT:
Thus, the program was executed successfully and the output was verified.
5
Ex.NO:1 IMPLEMENTION OF RECURSIVE AND NON – RECURSIVE ALGORITHMS
d) BINARY SEARCH
AIM:
To write a C program to perform Binary Search in a sorted array of elements.
ALGORITHM:
STEP 1: Start the Program.
STEP 2: Read the sorted array of elements and the Key element to be searched.
STEP 3: Declare the required variables.
STEP 4: Initialize First=0; Last=n-1 and Calculate Mid= (First + Last)/2.
STEP 5: Compare the Key element with the element at the 'Mid' index:
a: If they are equal, the Key element is found at index Mid.
b: If the Key element<Mid, update Last=Mid-1 to search in the lower half.
c: If the Key element>Mid, update First=Mid +1 to search in the upper half.
STEP 6: Repeat Step 5 until First>Last.
STEP 7: If First>Last, the Key element is not found in the array.
STEP 8: Stop the Program.
PROGRAM (without recursion):
#include<stdio.h>
void main()
{
int c,first,last,middle,n,key,array[100];
printf("Enter the size of an array \n");
scanf("%d",&n);
printf("Enter the values in sorted order:\n");
for(c=0;c<n;c++)
scanf("%d",&array[c]);
printf("Enter a value to be searched:");
scanf("%d",&key);
first=0;
last=n-1;
middle=(first+last)/2;
while(first<=last)
{
if(array[middle]<key)
first=middle+1;
else if (array[middle]==key){
printf Element is found at index %d\n",middle);
break;
}
else
last=middle-1;
middle=(first+last)/2;
}
if(first>last)
printf("Element is not found\n”);
}
ALGORITHM:
STEP 1: Start the Program.
STEP 2: Declare the required variables.
STEP 3: Read the number of elements in Num.
STEP 4: Read the sorted elements into the array Arr[].
STEP 5: Read the Key element to be searched.
6
STEP 6: Initialize Beg=0, End=Num-1
STEP 7: Call BinarySearch(Arr[], Num, Beg, End)
STEP 8: Calculate Mid= (First + Last)/2 where First = Beg, Last = End.
STEP 9: Compare the Key element with the element at the 'Mid' index:
a: If they are equal, the Key element is found at index Mid.
b: If the Key element<Mid, Call BinarySearch(Arr[], Num, First, Mid-1) to search in
the lower half of the array.
c: If the Key element>Mid, Call BinarySearch(Arr[], Num, Mid +1, Last) to search in
the upper half of the array.
STEP 10: Repeat Step 9 until First>Last.
STEP 11: If First>Last, the Key element is not found in the array.
STEP 12: Stop the Program.
PROGRAM (with recursion):
#include <stdio.h>
#include <stdlib.h>
void Binary_search(int[],int,int,int);
void main()
{int arr[100],beg,mid,end,i,n,num;
printf("Enter the size of an array:");
scanf("%d",&n);
printf("Enter the values in sorted order:\n");
for(i=0;i<n;i++)
scanf("%d",&arr[i]);
beg=0;
end=n-1;
printf("Enter a value to be searched:");
scanf("%d",&num);
Binary_search(arr,num,beg,end);
}
void Binary_search(int arr[],int num,int first, int last)
{
int mid;
if(first>last)
{
printf("Element is not found");
}
else
{
mid=(first+last)/2;
if(arr[mid]==num)
{
printf("Element is found at index %d",mid);
}
else if (arr[mid]>num)
{
Binary_search(arr,num,first,mid-1);
}
else
{Binary_search(arr,num,mid+1,last);
}}}
RESULT:
Thus, the program was executed successfully and the output was verified.
7
Ex.NO:2 DIVIDE AND CONQUER
a) STRASSEN’S MATRIX MULTIPLICATION
AIM:
To write a C program to implement Strassen’s Matrix Multiplication using the
Divide and Conquer technique.
DESCRIPTION:
STRASSEN’S MATRIX MULTIPLICATION
Strassen's matrix multiplication is an algorithm for multiplying two matrices
using a divide-and-conquer approach. Strassen's algorithm is more efficient than the
traditional matrix multiplication algorithm for large matrices, but the constant
overhead of the divide-and-conquer approach and the additional matrix products
make it less efficient for small matrices.
ALGORITHM:
STEP 1: Start
STEP 2: Divide the input matrices A and B into four equal-sized sub-matrices: A11,
A12, A21, and A22 for matrix A, and B11, B12, B21, and B22 for matrix B.
STEP 3: Compute the following seven matrix products:
P1 = A11 * (B12 - B22)
P2 = (A11 + A12) * B22
P3 = (A21 + A22) * B11
P4 = A22 * (B21 - B11)
P5 = (A11 + A22) * (B11 + B22)
P6 = (A12 - A22) * (B21 + B22)
P7 = (A11 - A21) * (B11 + B12)
STEP 4: Compute the four sub-matrices of the result matrix C using the following
equations:
C11 = P5 + P4 - P2 + P6
C12 = P1 + P2
C21 = P3 + P4
C22 = P5 + P1 - P3 - P7
STEP 5: Combine the sub-matrices C11, C12, C21, and C22 to form the final result
matrix C.
STEP 6: Return the final result matrix C.
STEP 7: Stop the Program.
PROGRAM:
#include<stdio.h>
int main()
{
int a[2][2], b[2][2], c[2][2], i, j;
int m1, m2, m3, m4 , m5, m6, m7;
printf("Enter the 4 elements of first matrix: ");
for(i = 0;i < 2; i++)
for(j = 0;j < 2; j++)
scanf("%d", &a[i][j]);
printf("Enter the 4 elements of second matrix: ");
for(i = 0; i < 2; i++)
for(j = 0;j < 2; j++)
scanf("%d", &b[i][j]);
printf("\nThe first matrix is\n");
for(i = 0; i < 2; i++){
printf("\n");
for(j = 0; j < 2; j++)
printf("%d\t", a[i][j]);
8
}
printf("\nThe second matrix is\n");
for(i = 0;i < 2; i++){
printf("\n");
for(j = 0;j < 2; j++)
printf("%d\t", b[i][j]);
}
m1= (a[0][0] + a[1][1]) * (b[0][0] + b[1][1]);
m2= (a[1][0] + a[1][1]) * b[0][0];
m3= a[0][0] * (b[0][1] - b[1][1]);
m4= a[1][1] * (b[1][0] - b[0][0]);
m5= (a[0][0] + a[0][1]) * b[1][1];
m6= (a[1][0] - a[0][0]) * (b[0][0]+b[0][1]);
m7= (a[0][1] - a[1][1]) * (b[1][0]+b[1][1]);
c[0][0] = m1 + m4- m5 + m7;
c[0][1] = m3 + m5;
c[1][0] = m2 + m4;
c[1][1] = m1 - m2 + m3 + m6;
printf("\nAfter multiplication using Strassen's algorithm \n");
for(i = 0; i < 2 ; i++){
printf("\n");
for(j = 0;j < 2; j++)
printf("%d\t", c[i][j]);
}
return 0;
}
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
17
c) FLOYD’S ALGORITHM
AIM:
To write a C program to implement Floyd’s Algorithm using the Dynamic
programming technique.
DESCRIPTION:
FLOYD’S ALGORITHM
Floyd’s algorithm is an algorithm for finding the shortest paths in a directed
weighted graph with positive or negative edge weights. A single execution of the
algorithm will find the lengths of the shortest paths between all pairs of vertices.
ALGORITHM:
STEP 1: Start the program.
STEP 2: Read the weight matrix.
STEP 3: Initialize the distance matrix with infinity.
STEP 4: Find all pair shortest paths using k intermediate vertices by considering all N
vertices as intermediate nodes.
STEP 5: For every pair (i, j) vertices, there are two possible cases.
k is not an intermediate vertex in the shortest path from i to j.
o We keep the value of dist[i][j] as it is.
k is an intermediate vertex in the shortest path from i to j.
o We update the value of dist[i][j] as dist[i][k] + dist[k][j].
STEP 6: Print the updated distance matrix.
STEP 7: Stop the program.
PROGRAM:
#include<stdio.h>
int min(int,int);
void floyds(int dist[10][10],int n)
{
int i,j,k;
for(k=1;k<=n;k++)
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(i==j)
dist[i][j]=0;
else
dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
}
int min(int a,int b){
if(a<b)
return(a);
else
return(b);
}
void main()
{
int dist[10][10],w,n,e,u,v,i,j;
printf("\n Enter the number of vertices:");
scanf("%d",&n);
printf("\n Enter the number of edges:\n");
scanf("%d",&e);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
18
dist[i][j]=99999999;
}
for(i=1;i<=e;i++)
{
printf("\n Enter the end vertices of edge %d with its weight \n",i);
scanf("%d %d %d",&u,&v,&w);
dist[u][v]=w;
}
printf("\n Matrix of input data:\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
printf("%d \t",dist[i][j]);
printf("\n");
}
floyds(dist,n);
printf("\n Transitive closure:\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
printf("%d \t",dist[i][j]);
printf("\n");
}
printf("\n The shortest paths are:\n");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
if(i!=j)
printf("\n <%d,%d>=%d",i,j,dist[i][j]);
}
}
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
23
for the symbols used in encoding data using Greedy Technique.
DESCRIPTION:
HUFFMAN TREES:
The Huffman tree is the binary tree with minimum external path weight, i.e., the
one with the minimum sum of weighted path lengths for the given set of leaves. Here
the goal is to build a tree with the minimum external path weight.
HUFFMAN CODING:
Huffman Coding is a technique of compressing data to reduce its size without
losing any of the details. It was first developed by David Huffman. Huffman Coding is
generally useful to compress the data in which there are frequently occurring
characters.
ALGORITHM:
Step 1: Start the program.
Step 2: Create a priority queue Q consisting of each unique character.
Step 3: Sort them in ascending order of their frequencies.
Step 4: For all unique characters:
Create a new node.
Extract the minimum value from Q and assign it to the left child of the new
node.
Extract the minimum value from Q and assign it to the right child of the new
node.
Calculate the sum of these two minimum values and assign it to the value of the
new node.
Insert this new node into the tree.
Step 5: Return the root node.
Step 6: Stop the program.
PROGRAM:
#include <stdio.h>
#include <stdlib.h>
#define MAX_TREE_HT 100
struct MinHeapNode {
char data;
unsigned freq;
struct MinHeapNode *left, *right;
};
struct MinHeap
{
unsigned size;
unsigned capacity;
struct MinHeapNode** array;
};
struct MinHeapNode* newNode(char data, unsigned freq)
{
struct MinHeapNode* temp = (struct MinHeapNode*)malloc(sizeof(struct
MinHeapNode));
temp->left = temp->right = NULL;
temp->data = data;
temp->freq = freq;
return temp;
}
struct MinHeap* createMinHeap(unsigned capacity)
{
24
struct MinHeap* minHeap = (struct MinHeap*)malloc(sizeof(struct MinHeap));
minHeap->size = 0;
minHeap->capacity = capacity;
minHeap->array = (struct MinHeapNode**)malloc(minHeap->capacity *
sizeof(struct MinHeapNode*));
return minHeap;
}
void swapMinHeapNode(struct MinHeapNode** a, struct MinHeapNode** b)
{
struct MinHeapNode* t = *a;
*a = *b;
*b = t;
}
void minHeapify(struct MinHeap* minHeap, int idx)
{
int smallest = idx;
int left = 2 * idx + 1;
int right = 2 * idx + 2;
if (left < minHeap->size && minHeap->array[left]->freq < minHeap-
>array[smallest]->freq)
smallest = left;
if (right < minHeap->size && minHeap->array[right]->freq < minHeap-
>array[smallest]->freq)
smallest = right;
if (smallest != idx) {
swapMinHeapNode(&minHeap->array[smallest], &minHeap->array[idx]);
minHeapify(minHeap, smallest);
}
}
int isSizeOne(struct MinHeap* minHeap)
{
return (minHeap->size == 1);
}
struct MinHeapNode* extractMin(struct MinHeap* minHeap)
{
struct MinHeapNode* temp = minHeap->array[0];
minHeap->array[0] = minHeap->array[minHeap->size - 1];
--minHeap->size;
minHeapify(minHeap, 0);
return temp;
}
void insertMinHeap(struct MinHeap* minHeap, struct MinHeapNode* minHeapNode)
{
++minHeap->size;
int i = minHeap->size - 1;
while (i && minHeapNode->freq < minHeap->array[(i - 1) / 2]->freq)
{
minHeap->array[i] = minHeap->array[(i - 1) / 2];
i = (i - 1) / 2;
}
minHeap->array[i] = minHeapNode;
}
void buildMinHeap(struct MinHeap* minHeap)
25
{
int n = minHeap->size - 1;
int i;
for (i = (n - 1) / 2; i >= 0; --i)
minHeapify(minHeap, i);
}
void printArr(int arr[], int n)
{
int i;
for (i = 0; i < n; ++i)
printf("%d", arr[i]);
printf("\n");
}
int isLeaf(struct MinHeapNode* root)
{
return !(root->left) && !(root->right);
}
struct MinHeap* createAndBuildMinHeap(char data[], int freq[], int size)
{
int i;
struct MinHeap* minHeap = createMinHeap(size);
for(i = 0; i < size; ++i)
minHeap->array[i] = newNode(data[i], freq[i]);
minHeap->size = size;
buildMinHeap(minHeap);
return minHeap;
}
struct MinHeapNode* buildHuffmanTree(char data[], int freq[], int size)
{
struct MinHeapNode *left, *right, *top;
struct MinHeap* minHeap = createAndBuildMinHeap(data, freq, size);
while (!isSizeOne(minHeap))
{
left = extractMin(minHeap);
right = extractMin(minHeap);
top = newNode('$', left->freq + right->freq);
top->left = left;
top->right = right;
insertMinHeap(minHeap, top);
}
return extractMin(minHeap);
}
void printCodes(struct MinHeapNode* root, int arr[], int top)
{
if (root->left)
{
arr[top] = 0;
printCodes(root->left, arr, top + 1);
}
if (root->right)
{
arr[top] = 1;
printCodes(root->right, arr, top + 1);
26
}
if (isLeaf(root))
{
printf("%c: ", root->data);
printArr(arr, top);
}
}
void HuffmanCodes(char data[], int freq[], int size)
{
struct MinHeapNode* root = buildHuffmanTree(data, freq, size);
int arr[MAX_TREE_HT], top = 0;
printCodes(root, arr, top);
}
int main()
{
char arr[] = { 'a', 'b', 'c', 'd', 'e', 'f' };
int freq[] = { 5, 9, 12, 13, 16, 45 };
int size = sizeof(arr) / sizeof(arr[0]);
HuffmanCodes(arr, freq, size);
return 0;
}
RESULT:
Thus, the program was executed successfully and the output was verified.
27
DESCRIPTION:
KNAPSACK PROBLEM:
Given a set of items, each with a weight and a value. Determine the number of
each item to include in a collection so that the total weight is less than a given limit
and the total value is as large as possible. The basic idea of the greedy approach is to
calculate the ratio profit/weight for each item and sort the item based on this ratio.
Then take the item with the highest ratio and add as much as we can (can be the
whole element or a fraction of it). This will always give the maximum profit because,
in each step, it adds an element such that this is the maximum possible profit for that
much weight.
ALGORITHM:
STEP 1: Start the program.
STEP 2: Read the input for the number of items, weight & value of items, and
knapsack capacity W.
STEP 3: Calculate the ratio (profit/weight) for each item.
STEP 4: Sort all the items in decreasing order of the ratio.
STEP 5: Initialize profit tp =0.
STEP 6: Do the following for every item i in the sorted order:
6.1. Check if the weight of the current item is less than or equal to the remaining
capacity then add the value of that item to the profit.
6.2. Otherwise, add a fraction of the current item.
STEP 7: Return the result vector and the profit.
STEP 8: Stop the program.
PROGRAM:
# include<stdio.h>
void knapsack(int n, float weight[], float profit[], float capacity) {
float x[20], tp = 0;
int i, j, u;
u = capacity;
for (i = 0; i < n; i++)
x[i] = 0.0;
for (i = 0; i < n; i++) {
if (weight[i] > u)
break;
else {
x[i] = 1.0;
tp = tp + profit[i];
u = u - weight[i];
}
}
if (i < n)
x[i] = u / weight[i];
tp = tp + (x[i] * profit[i]);
printf("\nThe result vector is:- ");
for (i = 0; i < n; i++)
printf("%f\t", x[i]);
printf("\nMaximum profit is:- %f", tp);
}
int main() {
float weight[20], profit[20], capacity;
int num, i, j;
float ratio[20], temp;
28
printf("\nEnter the no. of objects:- ");
scanf("%d", &num);
printf("\nEnter the weights and profits of each object:\n ");
for (i = 0; i < num; i++) {
scanf("%f %f", &weight[i], &profit[i]);
}
printf("\nEnter the capacity of knapsack:- ");
scanf("%f", &capacity);
for (i = 0; i < num; i++) {
ratio[i] = profit[i] / weight[i];
}
for (i = 0; i < num; i++) {
for (j = i + 1; j < num; j++) {
if (ratio[i] < ratio[j]) {
temp = ratio[j];
ratio[j] = ratio[i];
ratio[i] = temp;
temp = weight[j];
weight[j] = weight[i];
weight[i] = temp;
temp = profit[j];
profit[j] = profit[i];
profit[i] = temp;
}
}
}
knapsack(num, weight, profit, capacity);
return(0);
}
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
RESULT:
Thus, the program was executed successfully and the output was verified.
42