Final Ada Lab Program
Final Ada Lab Program
#include <stdio.h>
#include<conio.h>
int main() {
float a[100],sum=0,x;
int n,i;
printf("enter the degree of the polynomial::");
scanf("%d",&n);
printf("enter coefficient of the polynomial x::\n");
for(i=n;i>=0;i--)
{
printf("\n Enter coefficient of [x^%d]::",i);
scanf("%f",&a[i]);
}
printf("\n Enter the value of x::");
scanf("%f",&x);
for(i=n;i>0;i--)
{
sum=(sum+a[i])*x;
}
sum=sum+a[0];
printf("\n Value of the polynomial is [%f]\n",sum);
getch();
return 0;
}
OUTPUT:
Transitive closure
0 10 3 4
2 0 5 6
7 7 0 1
6 16 9 0
<1,2>=10
<1,3>=3
<1,4>=4
2,1>=2
2,3>=5
2,4>=6
3,1>=7
3,2>=7
3,4>=1
4,1>=6
4,2>=16
4,3>=9
10.Write a C program to solve the string matching problem using Boyer Moore
Algorithm
#include <limits.h>
#include <stdio.h>
#include <string.h>
int badchar[NO_OF_CHARS];
badCharHeuristic(pat, m, badchar);
if (j < 0)
{
printf("\n pattern occurs at shift = %d", s);
else
int main()
{
char txt[] = "ABAAABCD";
char pat[] = "ABC";
search(txt, pat);
return 0;
}
Output
pattern occurs at shift = 4