Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added dk71/di-raiy/laba 1/bin/Release/result.exe
Binary file not shown.
35 changes: 35 additions & 0 deletions dk71/di-raiy/laba 1/dk_tool.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
int Factorial(int num)
{
int factorial = 1;
if (num > 0)
{
for(int i=1; i <= num; i++ )
{
factorial = factorial*i;
}
}
return factorial;
}
float REsult(float A,float B,float C)
{
if ( B < 0)
{
printf("ERROR. We did not learn the factorial of a negative number (((\n");
return 0;
}
float drob;
if (B + (C*C)==0)
{
printf("ERROR. To my regret I can not divide by zero, but I would like so much\n");
return 0;
}
drob = (A*B)/(B+(C*C));
float sum = 0;
for(int D = 0; D <= B; D++)
{
sum = sum + Factorial(D);
}
float result = sum + drob ;
return result;
}

2 changes: 2 additions & 0 deletions dk71/di-raiy/laba 1/dk_tool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include <stdio.h>
float REsult(float A,float B,float C);
60 changes: 60 additions & 0 deletions dk71/di-raiy/laba 1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#include <stdio.h>
#include "dk_tool.h"

int main()
{
printf(" Hello!This is my firs lab,pls do not judge strictly; \n"); // made by @a_z_0_0_o_o
printf(" Variant 8 (1);\n");
printf(" by di-raiy:\n");
printf("\n");
printf("\n");
printf("\n");
printf(" ________________________ \n");
printf(" | A * B B |\n"); // ��� �������
printf(" | Q = _______ + E D! |\n"); // �� ����� ����� �����
printf(" | B + C^2 D=0 |\n");
printf(" |------------------------|\n");
printf("\n");
printf("\n");
printf(" Input data A, B, C;\n");
char contin ;
do
{
printf(" Please, enter A : ");
float A;
while (!scanf("%f", &A)) { //������ �� ������
while (getchar() != '\n');
printf(" Input error(enter only numbers)\n try again A: ");
}
printf(" Please, enter B : ");
float B;
while (!scanf("%f", &B)) {
while (getchar() != '\n');
printf(" Input error(enter only numbers)\n try again B: ");
}
printf(" Please, enter C : ");
float C;
while (!scanf("%f", &C)) {
while (getchar() != '\n');
printf(" Input error(enter only numbers)\n try again C: ");
}
float result = REsult( A, B, C) ;
printf("\n");
printf("\n");
printf("...and having counted everything we received: %.1f\n", result);
printf("\n");
printf("\n");
printf("\n");
printf(" Do you want to continue?\ny - yes,any other button - no\n");
scanf(" %c", &contin);
}
while (contin == 'y');
printf("\n");
printf("\n");
printf("So quickly go away?It was nice to work with you)Goodbye!");
printf("\n");
printf("\n");
printf("\n");

return 0;
}
Binary file added dk71/di-raiy/laba 1/obj/Release/dk_tool.o
Binary file not shown.
Binary file added dk71/di-raiy/laba 1/obj/Release/main.o
Binary file not shown.
38 changes: 38 additions & 0 deletions dk71/di-raiy/laba 1/result.cbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="result" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="bin/Release/result" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="dk_tool.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="dk_tool.h" />
<Unit filename="main.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
12 changes: 12 additions & 0 deletions dk71/di-raiy/laba 1/result.depend
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# depslib dependency file v1.0
1519254707 source:c:\users\di_ray\desktop\result\main.c
<stdio.h>
"dk_tool.h"

1519254919 source:c:\users\di_ray\desktop\result\dk_tool.c

1519252788 c:\users\di_ray\desktop\result\dk_tool.h
<stdio.h>

1519252724 c:\users\di_ray\desktop\result\dk_tool.c

19 changes: 19 additions & 0 deletions dk71/di-raiy/laba 1/result.layout
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Release" />
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2145" topLine="0" />
</Cursor>
</File>
<File name="dk_tool.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="58" topLine="0" />
</Cursor>
</File>
<File name="dk_tool.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="754" topLine="6" />
</Cursor>
</File>
</CodeBlocks_layout_file>