Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "pch.h"
- #include <iostream>
- using namespace std;
- int sum(int a)
- {
- int s = 0;
- while (a)
- {
- s = s + a % 10;
- a = a / 10;
- }
- return s;
- }
- //Передача указателя
- void sum(int a, int *s)
- {
- *s = 0;
- while (a)
- {
- *s = *s + a % 10;
- a /= 10;
- }
- }
- int fdig_ldig(int a)
- {
- int b = a % 10;
- while (a > 9)
- {
- a /= 10;
- }
- return (a == b) ? 1 : 0;
- }
- int count_del(int a)
- {
- int k = 2;
- for (int d = 2; d <= a / 2;d++)
- {
- if (a%d == 0) k++;
- }
- return k;
- }
- int prime(int a)
- {
- if (a <= 1) return 0;
- int d = 2;
- while (d*d <= a)
- {
- if (a%d == 0) return 0;
- d++;
- }
- return 1;
- }
- int progr(int a)
- {
- if (a <= 100) return 0;
- int y = a % 10, z = a / 10 % 10;
- a /= 10;
- int d = y - z;
- while (a)
- {
- if (y - z != d) return 0;
- y = z; a /= 10; z = a % 10;
- }
- return 1;
- }
- double gorner(int n, double x)
- {
- double a, s = 0;
- cout << "Введите " << n + 1 << " коэффициентов многочлена: " << endl;
- for (int i = n; i >= 0; i--)
- {
- cin >> a;
- s = s * x + a;
- }
- return s;
- }
- int palindrom4ik(int a)
- {
- int s = 0, copya = a;
- while (a)
- {
- s = s * 10 + a % 10;
- a = a / 10;
- }
- return (s == copya) ? 1 : 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement