Binary Search
Binary Search
#include <stdio.h>
int main() {
int n, target, low, high, mid, found = 0;
int arr[n];
low = 0;
high = n - 1;
if (arr[mid] == target) {
printf("Element found at index %d\n", mid);
found = 1;
break;
}
if (!found) {
printf("Element not found in the array.\n");
}
return 0;
}
BUBBLE SORT
#include<stdio.h>
int main(){
int n,temp;
int arr[n];
return 0;
}
struct student {
char usn[10];
char name[10];
int m1, m2, m3;
float avg, total;
};
void main() {
struct student s[20];
int n, i;
// Output results
printf("\nResults:\n");
for (i = 0; i < n; i++) {
if (s[i].avg >= 35) {
printf("%s has scored above average\n", s[i].name);
} else {
printf("%s has scored below average\n", s[i].name);
}
}
}
PATTERN PRINTING
#include <stdio.h>
int main() {
int n = 3;