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 print_array(int* A, int N) { | |
for(int i = 0; i < N; i++){ | |
printf("%d ", A[i]); | |
} | |
printf("\n"); | |
} | |
void swap (int* a, int* b){ |
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 swap (int* a, int* b){ | |
int temp; | |
temp=*a; | |
*a=*b; | |
*b=temp; | |
} |
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 main() { | |
int N = 5, a[] = {4,5,2,1,3}, tmp; | |
for(int j=1; j<N; j++){ | |
for(int i =N-1; i>=j; i--){ | |
if(a[i]<a[i-1]){ | |
tmp = a[i]; | |
a[i] = a[i-1]; |
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 main() { | |
int a[] = {7, 4, 1, 5, 2}; | |
int n=5, min, min_j, temp; | |
for(int i = 0;i<n; i++){ | |
min = a[i]; | |
min_j = i; |
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 fact(int n){ | |
if (n <= 0){ | |
return 1; | |
} else { | |
return n * fact(n-1); | |
} | |
} |
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 gcd(int a, int b) { | |
if (a == b) { | |
return a; | |
} | |
if (a < b) { | |
return gcd(a, b-a); | |
} else { | |
return gcd(a-b, b); |
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 a, int b) { | |
// return a + b; | |
//} | |
//int sum(double a, int b) { | |
// return (double)a + b; | |
//} | |
int fact(int n) { |
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 main() { | |
int count, current, min = 30000, min_position; | |
scanf("%d", &count); | |
for (int i = 1; i <= count; i++) { | |
scanf("%d", ¤t); | |
if (current < min && current % 7 == 0) { | |
min = current; |
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 main() { | |
// вместо | |
// int numbers[5]; | |
// numbers[0] = 3; | |
// numbers[1] = 2; | |
// numbers[2] = 8; | |
// numbers[3] = 7; |
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> | |
main() | |
{ | |
int a, b, c; | |
printf("Введите два целых числа \n"); | |
scanf("%d%d", &a, &b); | |
c=a+b; | |
printf("Результат: %d + %d = %d\n", a, b, c); |