2. 1. To swap two numbers without using a temporary variable.
2. To calculate the bill amount for an item given the quantity sold, rate, discount and tax.
3. 3. Program to enter any character. If the entered character is in lower case then convert it into uppercase and if it is
lower case then convert it into upper case.
4. To enter a character and determine whether it is vowel or not.
4. 5. Program to display a menu that offers five options: Read three numbers, calculate total, average, display the
smallest and largest value.
5. 7. To find the Fibonacci using recursive function.
6. 8. To insert a number at a given location in an array.
10. Accept any two strings from the user. Display whether both the strings are equal or not.(do not use standard
functions).
7. 11. Write a program to accept a list of 10 integers in an array, pass the starting address of array in sum function,
calculate the sum of the array elements in the function and return the sum calculated in the main function.
8. 12. Program to add two numbers using Command Line Arguments
LAB 2-3
Q1
14. OUTPUT
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY
Lab-9
Laboratory Objective: To implement scheduling algorithms in C.
Learning Outcome: Implementation of scheduling algorithms.
15. 1. Implement Priority Scheduling algorithm for three process having the following Burst Time and
Priorities:
Process Burst Time Priority
1 5 2
2 7 1
3 6 3
4 5 4
17. DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY
Lab-10
Laboratory Objective: To implement scheduling algorithms.
Learning Outcome: Implementation of scheduling algorithms.
2. Implement Producer Consumer Problem using Semaphore:
25. 2- BEST FIT
#include<stdio.h>
void main()
{
int fragment[20],b[20],p[20],i,j,nb,np,temp,lowest=9999;
static int barray[20],parray[20];
printf("ntttMemory Management Scheme - Best Fit");
printf("nEnter the number of blocks:");
scanf("%d",&nb);
printf("Enter the number of processes:");
scanf("%d",&np);
printf("nEnter the size of the blocks:-n");
for(i=1;i<=nb;i++)
{
printf("Block no.%d:",i);
scanf("%d",&b[i]);
}
printf("nEnter the size of the processes :-n");
for(i=1;i<=np;i++)
{
printf("Process no.%d:",i);
scanf("%d",&p[i]);
}
for(i=1;i<=np;i++)
{
for(j=1;j<=nb;j++)
{
if(barray[j]!=1)
{
temp=b[j]-p[i];
if(temp>=0)
if(lowest>temp)
{
parray[i]=j;
lowest=temp;
27. 3- WORST FIT
#include<stdio.h>
int main()
{
int fragments[10], blocks[10], files[10];
int m, n, number_of_blocks, number_of_files, temp, top = 0;
static int block_arr[10], file_arr[10];
printf("nEnter the Total Number of Blocks:t");
scanf("%d",&number_of_blocks);
printf("Enter the Total Number of Files:t");
scanf("%d",&number_of_files);
printf("nEnter the Size of the Blocks:n");
for(m = 0; m < number_of_blocks; m++)
{
printf("Block No.[%d]:t", m + 1);
scanf("%d", &blocks[m]);
}
printf("Enter the Size of the Files:n");
for(m = 0; m < number_of_files; m++)
{
printf("File No.[%d]:t", m + 1);
scanf("%d", &files[m]);
}
for(m = 0; m < number_of_files; m++)
{
for(n = 0; n < number_of_blocks; n++)
{
if(block_arr[n] != 1)
{
temp = blocks[n] - files[m];
if(temp >= 0)
{
if(top < temp)
{
file_arr[m] = n;
top = temp;
}
}
34. FIFO PAGE REPLACEMENT ALGO
#include<stdio.h>
int main()
{
int i,j,n,a[50],frame[10],no,k,avail,count=0;
printf("n ENTER THE NUMBER OF PAGES:n");
scanf("%d",&n);
printf("n ENTER THE PAGE NUMBER :n");
for(i=1;i<=n;i++)
scanf("%d",&a[i]);
printf("n ENTER THE NUMBER OF FRAMES :");
scanf("%d",&no);
for(i=0;i<no;i++)
frame[i]= -1;
j=0;
printf("tref stringt page framesn");
for(i=1;i<=n;i++)
{
printf("%dtt",a[i]);
avail=0;
for(k=0;k<no;k++)
if(frame[k]==a[i])
avail=1;
if (avail==0)
{
frame[j]=a[i];
j=(j+1)%no;
count++;