This commit is contained in:
Michał Krzysztof Feiler 2019-01-24 03:36:18 +01:00
parent 6bce1cda35
commit 47722313e1
No known key found for this signature in database
GPG Key ID: E35C2D7C2C6AC724
3 changed files with 113 additions and 0 deletions

73
asdzes2zad3heron/.gitignore vendored Normal file
View File

@ -0,0 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

View File

@ -0,0 +1,7 @@
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.c

33
asdzes2zad3heron/main.c Normal file
View File

@ -0,0 +1,33 @@
#include <math.h>
#include <stdio.h>
static long long unsigned c;
static long double eps;
static long double x;
static long long unsigned n;
int next()
{
long double p = x;
x = (p + (c / p)) / 2;
n++;
return fabsl(x - p) >= eps;
}
void print()
{
printf("x_%llu=%Lf, ", n, x);
}
int main()
{
scanf("%llu %Lf", &c, &eps);
x = c;
n = 0;
print();
while (next())
print();
print();
return 0;
}