Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <math.h>
- int func5_1(int a, int b, int h);
- // Y = log( sqrt( exp( X - 1 ) ) )
- int func5_1(int a, int b, int h) {
- double y = 0;
- int x = 0;
- int i = 0;
- if((b <= 0) || (h <= 0)) {
- fprintf(stderr, "b or h should be higher then 0\n");
- return 0;
- }
- do {
- if(i == 0) {
- x = a;
- } else if(i == 1) {
- x = a + h;
- } else {
- x = a + h + i;
- }
- y = log( sqrt( exp( (double)(x - 1) ) ) );
- printf("With y = %3.2lf as result and b = %d as limit\n", y, b);
- i++;
- } while(y <= (double)b);
- return 0;
- }
- int main(int argc, char **argv) {
- func5_1(-1, 20, 20);
- return 0;
- }
Add Comment
Please, Sign In to add comment