Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://vk.com/evgenykravchenko0
- ___ ___ ___
- / /\ ___ / /\ / /\
- / /:/_ /__/\ / /:/_ / /:/_
- / /:/ /\ \ \:\ / /:/ /\ / /:/ /\
- / /:/ /:/_ \ \:\ / /:/_/::\ / /:/ /:/_
- /__/:/ /:/ /\ ___ \__\:\ /__/:/__\/\:\ /__/:/ /:/ /\
- \ \:\/:/ /:/ /__/\ | |:| \ \:\ /~~/:/ \ \:\/:/ /:/
- \ \::/ /:/ \ \:\| |:| \ \:\ /:/ \ \::/ /:/
- \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\/:/
- \ \::/ \__\::::/ \ \::/ \ \::/
- \__\/ ~~~~ \__\/ \__\/
- ___
- /__/\ ___ ___
- \ \:\ / /\ / /\
- \ \:\ / /:/ / /:/
- _____\__\:\ /__/::\ /__/::\
- /__/::::::::\ \__\/\:\__ \__\/\:\__
- \ \:\~~\~~\/ \ \:\/\ \ \:\/\
- \ \:\ ~~~ \__\::/ \__\::/
- \ \:\ /__/:/ /__/:/
- \ \:\ \__\/ \__\/
- \__\/
- #include <stdio.h>
- float Method_Newt_sqrt(float x, float now, float next)
- {
- if (now - next > 0.00001)
- {
- now = next;
- next = (now + x / now) / 2.0f;
- return Method_Newt_sqrt(x, now, next);
- }
- else
- return next;
- }
- int main()
- {
- float x;
- float y;
- float sqr;
- float next;
- printf("Введите значение x : ");
- scanf("%f", &x);
- y = x / 2.0f;
- next = (y + x / y) / 2.0f;
- sqr = Method_Newt_sqrt(x, y, next);
- printf("Корень из %.0f = %.5f\n", x, sqr);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement