(&&). , - 13 19.
#include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter an age and press ENTER: ";
cin >> n;
if (n > 12 && n < 20)
cout << "Subject is a teenager.";
else
cout << "Subject is not a teenager.";
return 0;
}
3: ( 60 ).
C++ -. cout cin, :
#include <iostream>
C++ ( +, *, - %) , . , , :
#include <math.h>
(sin, cos, tan, asin, acos, atan ..), (log, Iog10), (pow, exp) . : sqrt, .
#include <math.h>
double ;
= sqrt(2.0); // 2
3.
C++, - : , . , 1.
, 12000 ( 10), , 12001.
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int n; //
int i; //
int is_prime; //
// ,
is_prime = true;
//
cout << "Enter a number and press ENTER: ";
cin >> n;
// .
i = 2;
while (i <= sqrt(static_cast<double>(n))) // i <= sqrt(n),
{
if (n % i == 0) //
is_prime = false; // n
i++; // 1 i
}
//
if (is_prime)
cout << "Number is prime.";
else
cout << "Number is not prime.";
return 0;
}
!!!
static_cast<double>(n) . ++. : (double)n. ++.
4: n!
5: sin(1)+sin(2) + + sin(n)
6: 1 n , 3.