Вы находитесь на странице: 1из 13

# 1

: .
:
.
:
(*)
(**)
(***)
:
)

i = 1; z = 1,75

i = 2; z = 13,4

1.

x y (, b)
y (*), L (**), x (***).

. .

6050101.2141.19.01

2.

,
,
( ).
:
1)

. 2;

2)

(*), ,

y. 3;
3)

(**), ,

l. 4;
4)

(***),

3 l, x. 5;
5)

. .

. .

6050101.2141.19.01

3.

3.1.

3.1.1.
3.1.2. main

main. GCC
int.
{}
, .. ,
.
;.
3.1.3.
.

.
,
.

.
:
[] _ [ .];

## - signed, unsigned, short, long.

- char int,
.
- .
z, l (
: double ), i, y, x ( : int )

. .

6050101.2141.19.01

3.1.4. /
,
,
<stdio.h>.
#include <stdio.h>
stdio - /.
, /,

#include

<stdio.h>
3.1.4.1 scanf()
int scanf( const char*,

);

scanf() - .
.
, , , .

. :
, .
%.
:
%d

%lf
scanf(),
, .

&, .

. .

6050101.2141.19.01

3.1.4.2 printf()
int printf( const char*,

);

printf() .

. : ,
, ,
, .
printf() .
, ,
.
. %
.

. .

6050101.2141.19.01

3.1.5

.
<math.h>,
.
#include <math.h>

:

pow( x, y ) ,

, ;

sin( x) ;

exp(x) - x

. HUGE,
exp 0.

. .

6050101.2141.19.01

3.1.6

lab1.c. 3.1.6.
3.1.6
#include <stdio.h>
#include <math.h>
int main()
{
double z, l, x;
int i, y;
printf( "Enter i, z: " );
scanf( "%d%lf", &i, &z );
y = pow( 3, i ) + 1;
L = exp( -y * z );
x = cbrt( pow( sin( 2 * z ), 3 )/pow( L, 3.0/4.0) + z ) );
printf( "y = %d, x = %lf\n ", y, x );
return 0;
}

. .

6050101.2141.19.01

3.1.7
1)

gcc . ,
: gcc lab1.c lm
2)

\a.out.
;
3)

\a.out,

.
.

. .

6050101.2141.19.01

3.1.8
(a
b).
: 3.1.8.1 a- , 3.1.8.2 b .
3.1.8.1
a-
olga@olga:~/ /aip1\$ ./a.out
Enter i, z: 1 1.75
y = 4, x = 1.000000

3.1.8.2
b-
olga@olga:~/ /aip1\$ ./a.out
Enter i, z: 2 13.4
y = 10, x = 1.000000

. .

6050101.2141.19.01

FORTRAN

3.2

3.2.1 /
Fortran .
, '*',

monitor.
PRINT
/. : PRINT format [, outputs ]
, namelist.
format [, inputs]
3.2.2 FORTRAN
Fortran,
,
:
** - ;
EXP(x) - . x
REAL COMPLEX. , x.
e**x;
SIN (x) x. x
REAL COMPLEX. , x.
REAL COMPLEX sin(x);
3.2.3 STOP
STOP .
STOP, -.

. .

6050101.2141.19.01

3.2.4 FORTRAN

lab1.f. 3.2.4
3.2.4. FORTRAN
program lab1
double precision z, l, x
integer y,i
print *, ' Enter i, z '
y = 3 ** i + 1
L = exp(- y * z)
x = ( ( sin( 2*z ) )**3/(L**( 3/4 )+z ) )**( 1.0/3.0 )
print *, ' y = ', y, ' x = ', x
stop
end

3.2.5
1)

FORTRAN

g77 gfortran .
, : g77 lab1.f gfortran lab1.f
2)

\a.out.
;
3)

\a.out,

. .

6050101.2141.19.01

3.2.6
FORTRAN
(a
b).
3.2.6.1 a
olga@olga:~/ /aip1\$ ./a.out
Enter i, z: 1 1.75
y =
4 x = 1.0000000000000000

3.2.6.2 b
olga@olga:~/ /aip1\$ ./a.out
Enter i, z: 2 13.4
y =
10 x = 1.0000000000000000

. .

6050101.2141.19.01

FORTRAN.
.

. .

6050101.2141.19.01

## Нижнее меню

### Получите наши бесплатные приложения

Авторское право © 2021 Scribd Inc.