diff --git a/proglabs/lab5/.1.c.swo b/proglabs/lab5/.1.c.swo deleted file mode 100644 index 9a5630f..0000000 Binary files a/proglabs/lab5/.1.c.swo and /dev/null differ diff --git a/proglabs/lab5/.1.c.swp b/proglabs/lab5/.1.c.swp deleted file mode 100644 index a72b345..0000000 Binary files a/proglabs/lab5/.1.c.swp and /dev/null differ diff --git a/proglabs/lab5/1.c~ b/proglabs/lab5/1.c~ deleted file mode 100644 index dbd9a52..0000000 --- a/proglabs/lab5/1.c~ +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int main(void) { - char l[26]; - - for (int i = 0; i < 26; ++i) { - l[i] = 'a' + i; - } - printf("t-t: "); - for (int i = 0; i < 26; ++i) { - printf("%c ", l[i]); - } - printf("\n"); - return 0; -} - diff --git a/proglabs/lab5/10 b/proglabs/lab5/10 deleted file mode 100755 index ec65441..0000000 Binary files a/proglabs/lab5/10 and /dev/null differ diff --git a/proglabs/lab5/11 b/proglabs/lab5/11 deleted file mode 100755 index 4bbe809..0000000 Binary files a/proglabs/lab5/11 and /dev/null differ diff --git a/proglabs/lab5/12 b/proglabs/lab5/12 deleted file mode 100755 index 8399aaa..0000000 Binary files a/proglabs/lab5/12 and /dev/null differ diff --git a/proglabs/lab5/13 b/proglabs/lab5/13 deleted file mode 100755 index f400b17..0000000 Binary files a/proglabs/lab5/13 and /dev/null differ diff --git a/proglabs/lab5/14 b/proglabs/lab5/14 deleted file mode 100755 index 849cef6..0000000 Binary files a/proglabs/lab5/14 and /dev/null differ diff --git a/proglabs/lab5/15 b/proglabs/lab5/15 deleted file mode 100755 index 9bb50a7..0000000 Binary files a/proglabs/lab5/15 and /dev/null differ diff --git a/proglabs/lab5/15.c~ b/proglabs/lab5/15.c~ deleted file mode 100644 index b8487ee..0000000 --- a/proglabs/lab5/15.c~ +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include - -int main() { - setlocale(LC_ALL, ""); - wchar_t s[256]; - wchar_t c; - int n = 0, st = 0; - - printf("write: "); - while(st == 0){ - wscanf(L"%lc", &c); - st = (c == '\n'); - s[n] = c; - n = n + (1 - st); - } - - while(n > 0) { - n -= 1; - wprintf(L"%lc", s[n]); - } - printf("\n"); - return 0; -} diff --git a/proglabs/lab5/16 b/proglabs/lab5/16 deleted file mode 100755 index c5ebfe5..0000000 Binary files a/proglabs/lab5/16 and /dev/null differ diff --git a/proglabs/lab5/17 b/proglabs/lab5/17 deleted file mode 100755 index 2d26337..0000000 Binary files a/proglabs/lab5/17 and /dev/null differ diff --git a/proglabs/lab5/18 b/proglabs/lab5/18 deleted file mode 100755 index 8a66260..0000000 Binary files a/proglabs/lab5/18 and /dev/null differ diff --git a/proglabs/lab5/2 b/proglabs/lab5/2 deleted file mode 100755 index 4043f30..0000000 Binary files a/proglabs/lab5/2 and /dev/null differ diff --git a/proglabs/lab5/3-1 b/proglabs/lab5/3-1 deleted file mode 100755 index 025a5cb..0000000 Binary files a/proglabs/lab5/3-1 and /dev/null differ diff --git a/proglabs/lab5/3-2 b/proglabs/lab5/3-2 deleted file mode 100755 index 31b5ede..0000000 Binary files a/proglabs/lab5/3-2 and /dev/null differ diff --git a/proglabs/lab5/4 b/proglabs/lab5/4 deleted file mode 100755 index b9b1fcd..0000000 Binary files a/proglabs/lab5/4 and /dev/null differ diff --git a/proglabs/lab5/5 b/proglabs/lab5/5 deleted file mode 100755 index a909782..0000000 Binary files a/proglabs/lab5/5 and /dev/null differ diff --git a/proglabs/lab5/5.c~ b/proglabs/lab5/5.c~ deleted file mode 100644 index afbd18c..0000000 --- a/proglabs/lab5/5.c~ +++ /dev/null @@ -1,29 +0,0 @@ -#include - -int main(){ - int r = 1; - char l, x; - scanf("%c", &x); - - for(char z = 'A'; z <= x; ++z) - r++; - for(int i = 1; i <= r; ++i){ - l = 'A'; - - for(int j = 0; j < r - i; ++j){ - printf(" "); - } - - for(int j = 0; j < i; ++j){ - printf("%c", l); - l++; - } - l -= 2; - for(int j = 0; j < i - 1; ++j){ - printf("%c", l); - l--; - } - printf("\n"); - } - return 0; -} diff --git a/proglabs/lab5/6 b/proglabs/lab5/6 deleted file mode 100755 index 612fb11..0000000 Binary files a/proglabs/lab5/6 and /dev/null differ diff --git a/proglabs/lab5/7 b/proglabs/lab5/7 deleted file mode 100755 index 7745196..0000000 Binary files a/proglabs/lab5/7 and /dev/null differ diff --git a/proglabs/lab5/a.out b/proglabs/lab5/a.out deleted file mode 100755 index 920475a..0000000 Binary files a/proglabs/lab5/a.out and /dev/null differ diff --git a/proglabs/lab5/8 b/proglabs/lab6/3 similarity index 92% rename from proglabs/lab5/8 rename to proglabs/lab6/3 index 8e5eb20..358458b 100755 Binary files a/proglabs/lab5/8 and b/proglabs/lab6/3 differ diff --git a/proglabs/lab6/3.c b/proglabs/lab6/3.c index 4bed706..f124af5 100644 --- a/proglabs/lab6/3.c +++ b/proglabs/lab6/3.c @@ -7,7 +7,7 @@ int main(){ a = 1; while(scanf("%d", &a) && a != 0){ if (a % 2 == 0){n1++; sum1 += a;} - else if (a % 2 == 1 || a % 2 == -1){n2++; sum2 += a;} + else ({n2++; sum2 += a;}); printf("num: "); } printf("eve nums: %d \t eve summ: %d \t mean: %d\n",n1,sum1,(sum1/n1)); diff --git a/proglabs/lab6/3.c~ b/proglabs/lab6/3.c~ new file mode 100644 index 0000000..135e069 --- /dev/null +++ b/proglabs/lab6/3.c~ @@ -0,0 +1,16 @@ +#include + +int main(){ + int a,n1,sum1,n2,sum2; + n1 = sum1 = n2 = sum2 = 0; + printf("num: "); + a = 1; + while(scanf("%d", &a) && a != 0){ + if (a % 2 == 0){n1++; sum1 += a;} + if (a % 2 != 0){n2++; sum2 += a;} + printf("num: "); + } + printf("eve nums: %d \t eve summ: %d \t mean: %d\n",n1,sum1,(sum1/n1)); + printf("odd nums: %d \t odd summ: %d \t mean: %d",n2,sum2,(sum2/n2)); + return 0; +} diff --git a/proglabs/lab5/1 b/proglabs/lab6/6 similarity index 73% rename from proglabs/lab5/1 rename to proglabs/lab6/6 index e5c9919..2761563 100755 Binary files a/proglabs/lab5/1 and b/proglabs/lab6/6 differ diff --git a/proglabs/lab6/6.c b/proglabs/lab6/6.c index ecd87a0..795a2b4 100644 --- a/proglabs/lab6/6.c +++ b/proglabs/lab6/6.c @@ -3,7 +3,7 @@ int main() { int a,b,c; a = b = c = 0; - printf("count ef:\n"); + printf("count ei:\n"); while((a = getchar()) != '#'){ if(a == 'i' && b == 'e'){c++;} b = a; diff --git a/proglabs/lab6/6.c~ b/proglabs/lab6/6.c~ new file mode 100644 index 0000000..ecd87a0 --- /dev/null +++ b/proglabs/lab6/6.c~ @@ -0,0 +1,13 @@ +#include + +int main() { + int a,b,c; + a = b = c = 0; + printf("count ef:\n"); + while((a = getchar()) != '#'){ + if(a == 'i' && b == 'e'){c++;} + b = a; + } + printf("count: %d",c); + return 0; +} diff --git a/proglabs/lab5/9 b/proglabs/lab6/9 similarity index 83% rename from proglabs/lab5/9 rename to proglabs/lab6/9 index 4729d47..e2170d1 100755 Binary files a/proglabs/lab5/9 and b/proglabs/lab6/9 differ diff --git a/proglabs/lab6/9.c b/proglabs/lab6/9.c index 5afb800..41701dd 100644 --- a/proglabs/lab6/9.c +++ b/proglabs/lab6/9.c @@ -3,7 +3,7 @@ int pr(long long n); int main() { long long int x,i; - int y = 1; + printf("Num: "); if(!(scanf("%lld",&x)))return 1; for(i = x; i > 1; --i) @@ -13,14 +13,13 @@ int main() { return 0; } -int pr(long long x) { - if (x < 2) return 0; - if (x == 2 || x == 3) return 1; - if (x % 2 == 0 || x % 3 == 0) return 0; +int pr(long long n) { + if (n < 2) return 0; + if (n == 2 || n == 3) return 1; + if (n % 2 == 0 || n % 3 == 0) return 0; - for (long long i = 5; i * i <= x; i += 6) { - if (x % i == 0 || x % (i + 2) == 0) - return 0; - } + for (long long i = 5; i * i <= n; i += 6) { + if (n % i == 0 || n % (i + 2) == 0) + return 0;} return 1; } diff --git a/proglabs/lab6/9.c~ b/proglabs/lab6/9.c~ new file mode 100644 index 0000000..e7b73ae --- /dev/null +++ b/proglabs/lab6/9.c~ @@ -0,0 +1,25 @@ +#include +int pr(long long n); + +int main() { + long long int x,i; + + if(!(scanf("%lld",&x)))return 1; + + for(i = x; i > 1; --i) + if(pr(i)) + printf("%lld\t",i); + + return 0; +} + +int pr(long long n) { + if (n < 2) return 0; + if (n == 2 || n == 3) return 1; + if (n % 2 == 0 || n % 3 == 0) return 0; + + for (long long i = 5; i * i <= n; i += 6) { + if (n % i == 0 || n % (i + 2) == 0) + return 0;} + return 1; +} diff --git a/proglabs/lab7-8/1.c b/proglabs/lab7-8/1.c new file mode 100644 index 0000000..d15d0e3 --- /dev/null +++ b/proglabs/lab7-8/1.c @@ -0,0 +1,14 @@ +#include +double min(double x, double y); + +int main(){ + double x,y; + printf("Enter: num1 num2\nEnter: "); + scanf("%lf %lf",&x,&y); + printf("lower: %lf\n",min(x,y)); + return 0; +} + +double min(double x, double y){ + return ((x>y)?x:y); +} diff --git a/proglabs/lab7-8/2.c b/proglabs/lab7-8/2.c new file mode 100644 index 0000000..87aaa36 --- /dev/null +++ b/proglabs/lab7-8/2.c @@ -0,0 +1,20 @@ +#include +void min(char ch, char i, char j); + +int main(){ + char ch, i, j; + + printf("Enter: char i j\nEnter: "); + scanf(" %c %c %c",&ch,&i,&j); + min(ch,i,j); + return 0; +} + +void min(char ch, char i, char j){ +int c = i; +for(;i<=j;i++){printf("%c\t",i);} +printf("\n"); +i = c; +for(;i<=j;i++){printf("%c\t",ch);} +printf("\n"); +} diff --git a/proglabs/lab7-8/3.c b/proglabs/lab7-8/3.c new file mode 100644 index 0000000..dd00e20 --- /dev/null +++ b/proglabs/lab7-8/3.c @@ -0,0 +1,21 @@ +#include +void table(char ch, int a, int b); + +int main(){ + char ch; + int a,b; + printf("Enter: Char num1 num2\nEnter: "); + scanf(" %c %d %d",&ch,&a,&b); + table(ch,a,b); + return 0; +} + +void table(char ch, int a, int b){ + //for(int i = 0;i<=a;i++){printf("%d",i);} + printf("\n"); + for(int i = 1;i<=b;i++){ + //printf("%d",i); + for(int x = 1;x<=a;x++){printf("%c",ch);} + printf("\n"); + } +} diff --git a/proglabs/lab7-8/4.c b/proglabs/lab7-8/4.c new file mode 100644 index 0000000..1a34602 --- /dev/null +++ b/proglabs/lab7-8/4.c @@ -0,0 +1,18 @@ +#include +double garmony(double a,double b); + +int main(){ + double a, b; + printf("Enter: num1 num2\nEnter: "); + scanf(" %lf %lf",&a,&b); + printf("garmony = %lf",garmony(a,b)); + return 0; +} + +double garmony(double a, double b){ + double x; + a *= -1; + b *= -1; + x = (((a+b)/2)*-1); + return x; +}