Professional Documents
Culture Documents
Aim:
Algorithm:
1. Read the values of x in degrees and convert it into radians and assign
1 to A.
7. End.
b.CALCULATION OF COS ( X)
Aim:
Algorithm:
2. Assign -1 to A and 1 to S.
1
“ C “ LAB MANUAL
8. End.
c.CALCULATION OF e x
Aim:
e x = 1 + x + (x 2 / 2!) + ……….. ( x n / n ! )
Algorithm:
7. End.
2
“ C “ LAB MANUAL
Algorithm:
6. End.
Aim:
Algorithm:
1. Read a string
4. If both the strings are equal then the entered string is a palindrome
3
“ C “ LAB MANUAL
6. End
Aim:
Algorithm:
5. End
d. SUBSTRING REMOVAL
Aim:
Algorithm:
5. End
e. FINDING AND REPLACING SUBSTRINGS
4
“ C “ LAB MANUAL
Aim:
To find a substring in a line of text and replace it with the given string
Algorithm:
6. End
Aim:
Algorithm:
6. End
5
“ C “ LAB MANUAL
Algorithm:
7. End
Aim:
6
“ C “ LAB MANUAL
Algorithm:
2. Check whether a is greater than b and assign s=a else assign s=b
4. If a%a1 is equal to zero and b%a1 is equal to zero then assign gcd =
a1
6. End.
Aim:
Algorithm:
4. End
e. FIBONACCI SEQUENCE
Aim:
7
“ C “ LAB MANUAL
Algorithm:
4. End
f. TOWER OF HONOI
Aim:
Algorithm:
5. End.
8
“ C “ LAB MANUAL
Aim:
Algorithm:
6. End
b. MATRIX MULTIPLICATION
Aim :
Algorithm :
9
“ C “ LAB MANUAL
10.Repeat step 6
11.Repeat step 5
12.Stop.
c. TRANSPOSE OF A MATRIX
Aim:
Algorithm:
2. Read the elements of the matrix using variable A (i,j) inside a for loop
using variables i and j.
5. End.
d. DETERMINANT OF A MATRIX
Aim :
Algorithm :
10
“ C “ LAB MANUAL
6. Initialize j as i+1 and repeat the loop until j is less than or equal to
r– 1
7. Initialize j as i+1 and repeat the loop until j is less than or equal to r
13.Calculate d as d * a[i][j]
15.Stop
e. INVERSE OF A MATRIX
11
“ C “ LAB MANUAL
Aim:
Algorithm:
2. If the rows and columns are not equal print that the rows and columns
are not equal
14.End
LINEAR SEARCH
Aim:
12
“ C “ LAB MANUAL
Algorithm:
1. Read the size of the array s and elements of the array using the
variable A(i)
4. If the number is found write the number is found and print the
position of the number.
5. End.
BINARY SEARCH
Aim:
To find whether the given number is found in the given array or not by
using Binary Search method.
Algorithm:
1. Read the size of the array N and the elements of the array.
6. End.
13
“ C “ LAB MANUAL
INSERTION SORT
Aim:
Algorithm:
2. Initialize I with n-1 continue the loop till i<=0 and x<a[i] , decrement i
a[i+1] = a[i]
a[i]=x
4. End
SELECTION SORT
Aim:
Algorithm:
2. The first element is compared with all the elements in the array one by
one
3. During the first iteration for example in the first step if the first element
is greater than the second element the both are swapped
14
“ C “ LAB MANUAL
6. End
BUBBLE SORT
Aim:
Algorithm:
6. End
15
“ C “ LAB MANUAL
PROGRAMMING IN C
16
“ C “ LAB MANUAL
17