zad3
This commit is contained in:
parent
6bce1cda35
commit
47722313e1
73
asdzes2zad3heron/.gitignore
vendored
Normal file
73
asdzes2zad3heron/.gitignore
vendored
Normal 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
|
||||
|
7
asdzes2zad3heron/asdzes2zad3heron.pro
Normal file
7
asdzes2zad3heron/asdzes2zad3heron.pro
Normal file
@ -0,0 +1,7 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
CONFIG -= qt
|
||||
|
||||
SOURCES += \
|
||||
main.c
|
33
asdzes2zad3heron/main.c
Normal file
33
asdzes2zad3heron/main.c
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user