Linux-Record-2023-24
Linux-Record-2023-24
2024-2025(ODD
SEMESTER)
DEPARTMENT
OF
COMPUTER
APPLICATION
NAME :
REGISTER NO :
COURSE : BCA AI & DS
YEAR/SEM/SEC :
BONAFIDE CERTIFICATE
Register No:
DATE OF PAGE
TOPIC SIGNATURE
SL.NO EXPERIMENT NO
Aim:
Algorithm:
Program:
Enter the
number13
The Number is Prime
Enter the
Number10
The Number is Composite
Result:
Experiment Date : 30/07/2024 Page No…
Aim:
Algorithm:
Program:
Enter a String
Madam
Palidrome String
Enter a String
Daddy
Not a palindrome string
Result:
Experiment Date : 01/08/2024 Page No…
Aim:
Algorithm:
Program:
Result:
Experiment Date : 06/08/2024 Page No…
Aim:
Algorithm:
Program:
Result:
Experiment Date : 08/08/2024 Page No…
Aim:
Algorithm:
Program:
#!/bin/bash
#for finding the value of x in "ax^2 + bx + c = 0"
ax^2+bx+c=0
a=8
b=8
c=1
X=-.14,-.85
Result:
Experiment Date : 13/08/2024 Page No…
Exercise Title : 6.MENU DRIVEN SHELL SCRIPT - SORT WITH VARIOUS OPTIONS
with APPLICATIONS OF PROCEDURES.
Aim:
Algorithm:
Program:
#bin/bash/sh
ch=1
case $ch in
1)awk 'BEGIN {
printf "\nEnter the no of data:"
getline n
printf "\nEnter the element for sorting in Ascending:\n"
for(i=0;i<n;i++)
{
getline s[i]
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(s[i]>s[j])
{
t=s[i]
s[i]=s[j]
s[j]=t
}
}
}
printf "\nAscending order is....\n"
for(i=0;i<n;i++)
printf("%d\n",s[i]);
}';;
2) awk 'BEGIN {
printf "\nEnter the no of data:"
getline n
printf "\nEnter the elements for sorting in Descending:\n" for(i=0;i<n;i+
+)
{
getline s[i]
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(s[i]<s[j])
{
t=s[i]
s[i]=s[j]
s[j]=t
} } }
printf "\nDescending order is.....\n"
for(i=0;i<n;i++)
printf "%d\n",s[i]
}';;
3) exit;;
esac
done
Output:
1.Ascending Order
2.Desending Order
3.Exit
Enter your choice: 1
Enter the no of data: 5
Enter the element for sorting in Ascending:
33
67
89
23
75
Ascending Order is....
23
33
67
75
89
1.Ascending Order
2.Descending Oder
3.Exit
Enter your choice:2
Enter the no of data: 3
Enter the element for sorting in Descending:
86
46
69
Descending order is.....
86
69
46
Result:
Experiment Date : 13/08/2024 Page No…
Aim:
Algorithm:
Program:
#!/bin/bash
echo -n "Enter Number between 0 and 9: "
read n
case $n in
0) echo 'You typed 0.';;
1|9) echo "$n is a perfect square.";;
3|5|7) echo "$n is a prime number.";;
4) echo "$n is a perfect square.
$n is an even number";; 2|6|
8) echo "$n is an even number.";;
*) echo 'Only single-digit numbers are allowed.';;
esac
Output:
Enter a Number between 0 and 9:
55 is a prime number.
Result:
Experiment Date : 22/08/2024 Page No…
Aim:
Algorithm:
Program:
#include<stdio.h>
main()
{
int n,a[10],b[10],t[10],w[10],g[10],i,m;
float att=0,awt=0;
for(i=0;i<0;i++)
{ a[i]=0;b[i]=0;w[i]=0;g[i]=
0;
}
printf(“Enter the number of processes:”);
scanf(“%d”,&n);
printf(“Enter the burst time:”);
for(i=0;i<n;i++)
scanf(“%d”,&b[i]);
printf(“Enter the arrival time:”);
for(i=0;i<n;i++)
scanf(“%d”,&a[i]);
g[0]=0;
for(i=0;i<10;i++)
{
w[i]=g[i]-a[i];
t[i]=g[i+1]-a[i];
awt=awt+w[i]
att=att+t[i];
}
awt=awt/n;
att=att/n;
printf(“\n\t Process\t Waiting time \t Turnaround time\n”);
for(i=0;i<n;i++)
{
printf(“\t %d\t\t %d\t\\t %d\n”I,w[i],t[i]);
}
printf(“\n The average waiting time is %t \n”,awt);
printf(“The average turnaround time is %f\n”,att);
OUTPUT:
Result:
Experiment Date : 31/08/2024 Page No…
Exercise Title : 9.PROCESS SCHEDULING: ROUND ROBIN
Aim:
Algorithm:
Program-:
#include<stdio.h>
int ttime,i,j,temp;
int main(void)
{
int pname[10],btime[10],pname2[10],btime2[10];
int n,x,z;
printf("Enter the process name & burst time for the process\n");
for(i=0;i<n;i++)
{
printf("Enter the process name");
scanf("%d",&pname2[i]);
printf("Enter the burst time for the process %d");
scanf("%d",&btime2[i]);
}
switch(x)
{
case 1:
rrobin(pname,btime,n);
break;
case 2:
exit(0);
break;
}
Enter the process name and burst time for the process
10
10
10
2.exit
1 5 5
2 5 10
3 5 15
1 0 20
2 0 25
3 0 30
0
Result:
Experiment Date : 09/09/2024 Page No…
Aim:
Algorithm:
Program:
#!/bin/bash
fact()
{
i=1
a=1
while [ $i -le $x ]
do
a=`expr $a \* $i`
i=`expr $i + 1`
done
}
echo “Enter the N value:”
read n
echo “Enter the R value:”
read r
x=$n
fact
nf=$a
x=$r
fact
rf=$a
x=`expr $n - $r`
fact
nrf=$a
res=`expr $rf \* $nrf`
res=`expr $nf / $res`
echo “the combination of $n C $r is $res.”
Output:
Enter the N value:
5
Enter the R value:
3
The combination of 5 C 3 is 10
Result: