Semester : S1 and S2
Subject : Computer Programming
Year : 2017
Term : DECEMBER
Branch : BIOTECHNOLOGY
Scheme : 2015 Full Time
Course Code : CS 100
Page:38
1=0,u=n-1;
c=binary(a,n,m,l,u);
if(c==0)
printf("Number is not found.");
else
printf("Number is found.");
return 0;
}
int binary(int a[],int n,int m,int 1111 u){
int mid,c=0;
if(l<=u){
mid=(1+u)/2;
if(m==a[mid]){
ടേ;
}
else if(mreturn binary(a,n,m,l,mid-1);
}
else
return binary(a,n,m,mid+1,u);
} else
return €;
}
Sample output:
Enter the size of an array: 5
Enter the elements of the array: 8 9 10 11 12
Enter the number to be search: 8
Write notes on any ten file handling functions with syntax
The fopen() function is used to create a new file or to open an existing file.
Number is found.
8 a)
Opening a File or Creating a File
General Syntax :
*fp = FILE *fopen(const char *filename, const char *mode);
r+ opens a text file in both reading
and writing mode w+ opens 2 text
file in both reading and writing
(10)