netjunky

Untitled

Oct 10th, 2010
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. main()
  4. { double A,B,H,X,Y;
  5.  int i;
  6.  
  7.  printf("Y = ln( sqrt( e^(x - 1) ) ) tabuleerimine 1. meetodiga\n");
  8.  
  9.  printf("Enter A=");
  10.  scanf("%lf", &A);
  11.  
  12.  printf("B=");
  13.  scanf("%lf", &B);
  14.  
  15.  if (A>B) {
  16.           do {
  17.                printf("H (H<0)=");
  18.                scanf("%lf",&H); }
  19.                 while (H>0);}
  20.  else {
  21.            do {
  22.                printf("H (H>0)=");
  23.                scanf("%lf",&H); }
  24.                 while (H<0);
  25.                }
  26.                
  27.   printf("  ARGUMENT  |  Funktsioon\n");
  28.   printf("__________________________\n");
  29.    
  30.     do {
  31.       if(i==0) {
  32.         X=A; }
  33.       if (X>B) {
  34.         if (i==1) {
  35.           X=A+H; }
  36.         if (i>1) {
  37.           X=A+i*H; }
  38.         if (X<=B) {
  39.           return 0; }
  40.          
  41.        if (X<B) {
  42.          if (i==1) {
  43.            X=A+H; }
  44.          if (i>1) {
  45.            X=A+i*H; }
  46.          if (X>=B) {
  47.            return 0; }
  48.            }
  49.         }
  50.            
  51. Y=log( sqrt( exp( (double)(X-1))));
  52. if (exp(X-1)<0)
  53.   printf("Puudub");
  54. else
  55.   printf("%10.4lf  |%10.4lf  ",X,Y);
  56. i++;
  57. } while(1);
  58.  
  59. return 0;
  60. }
Add Comment
Please, Sign In to add comment