.


:




:

































 

 

 

 


1_8_1.




#include <iostream>

using std::endl;

using std::cin;

using std::cout;

int main () // main

{

int int1; // ,

int int2; // ,

int sum; //

cout << " "<< endl;

cin >> int1; //

cout << " "<< endl;

cin >> int2; //

sum = int1 + int2; //

cout << " " << sum << endl; //

return 0; // main ,

// ,

}

 

1_8_2. a, b, c.

 

1

#include <iostream>

using std::cin;

using std::cout;

using std::endl;

Int main()

{

int a, b, c;

cout << "\n a, b, c:";

cin>> a >> b >> c;

if (a>b)

if (a>c) cout<<"max= "<< a << endl;

else cout<<"max= "<< c << endl;

else

if (b>c) cout<<"max= "<< b << endl;

else cout<<"max= "<< c << endl;

system("pause");

return 0;

}

2

#include <iostream>

using std::cin;

using std::cout;

using std::endl;

Int main()

{

int a, b, c;

int max;

cout << "\n a, b, c:";

cin>> a >> b >> c;

max = (a>b)? a: b;

if (c>max) max = c;

cout<<"max= "<< max << endl;

system("pause");

return 0;

}

 

 

1_8_3. 5 8

1.

#include <iostream>

using std::cin;

using std::cout;

using std::endl;

Int main()

{

int num, k=0;

cout << "\ n :"; cin >> num;

while (num>0) {

if ((num%10==5)||(num%10==8)) k++;

num/=10;

}

cout<<k<<endl;

system("pause");

return 0;

}

 

2.

#include <iostream>

using std::cin;

using std::cout;

using std::endl;

Int main()

{

int num, k=0;

cout << "\ n :";

cin >> num;

for (; num>0; num/=10)

if ((num%10==5)||(num%10==8)) k++;

cout<<k<<endl;

system("pause");

return 0;

}

1_8_4.

1.

#include <iostream>

using std::cin;

using std::cout;

using std::endl;

Int main()

{

int num;

cout << "\n :"; cin>>num;

int half = num/2;

int div=2;

while (div<=half) {

if (!(num%div)) cout <<div<<endl;

div++;

system("pause");

return 0;

}

2.

#include <iostream>

using std::cin;

using std::cout;

using std::endl;

Int main()

{

int num;

cout << "\n :";

cin>>num;

int half, div;

for (half = num/2, div=2; div<=half; ++div)

if (!(num%div)) cout <<div<<endl;

system("pause");

return 0;

}

1_8_5. x Eps :

, , . , Eps.

#include <iostream> // system

#include <stdio.h> // scanf printf

# include < math. h > // fabs ( )

int main () {

double x, Eps; //

double yp, y = 1; //

printf (" : ");

scanf ("%lf%lf", &x, &Eps);

do {

yp = y; y = (yp + x/yp)/2;

} while (fabs(y - yp) >= Eps);

printf ("\n %lf %lf", x, y);

system("pause");

return 0;

}





:


: 2018-10-14; !; : 291 |


:

:

,
==> ...

1718 - | 1480 -


© 2015-2024 lektsii.org - -

: 0.022 .