This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int search(int *, int, int, int); | |
int main() | |
{ | |
int arr[] = {2, 4, 8, 16, 32, 64, 128, 256}; | |
int size = sizeof(arr) / sizeof(arr[0]); | |
int find = 128; | |
printf("%d is found at Array index: %d.", find, search(arr, 0, (size - 1), find)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void getData(int *, int *, int); | |
int main() | |
{ | |
int arr[] = {11, 44, -2, 351, -1129, 34, 3, -124, 25, -9}; | |
int size = sizeof(arr) / sizeof(arr[0]); | |
int count[4]; | |
getData(arr, count, size); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ------------ Print prime numbers using sieve of Eratosthenes. ------------ */ | |
#include <stdio.h> | |
int main() | |
{ | |
int size = 100; | |
int arr[size]; | |
int i, j, k; | |
int half; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void binary(int); | |
int main() | |
{ | |
int num, place = 1, bin = 0, rem; | |
printf("Enter a number: "); | |
scanf("%d", &num); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int sum(int); | |
int main() | |
{ | |
int num; | |
printf("Enter a number: "); | |
scanf("%d", &num); | |
printf("\nSum of first %d number is: %d\n", num, sum(num)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void gcd(int, int); | |
int main() | |
{ | |
int num1, num2; | |
printf("Enter two numbers: "); | |
scanf("%d %d", &num1, &num2); | |
gcd((num1 >= num2) ? num1, num2 : num2, num1); |
NewerOlder