Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 1
- int main(){
- int sum, n, x, xt, k = 0;
- cout << "Amount of numbers: ";
- cin >> n;
- for(int i = 1; i<=n; i++)
- {
- cin >> x;
- xt = x;
- while(xt != 0)
- {
- if(xt%10 == 7){sum += x;}
- xt = xt / 10;
- k++;
- }
- k = 0;
- }
- cout << "Res: " << sum;
- }
- 2
- int main(){
- int sum, n, x, xt, k = 0;
- cout << "Amount of numbers: ";
- cin >> n;
- for(int i = 1; i <= n; i++)
- {
- cin >> x;
- xt = x;
- while(xt > 0)
- {
- sum += xt%10;
- xt /= 10;
- }
- if(sum%2==0){k++;}
- }
- cout << "Res: " << k;
- }
- 3
- int main(){
- int n, x, xt, check = 0, c=1, k = 0;
- cout << "Amount of numbers: ";
- cin >> n;
- for(int i = 1; i <= n; i++)
- {
- cin >> x;
- while(c != x)
- {
- if(x%c==0){check++;}
- c++;
- }
- c = 2;
- if(check == 0){k++;}
- check = 0;
- }
- cout << "Res: " << k;
- }
- 4
- int main(){
- int n, sum, x, xt, c=1, k;
- cout << "Amount of numbers: ";
- cin >> n;
- for(int i = 1; i <= n; i++)
- {
- cin >> x;
- while(c < x)
- {
- if(x%c==0){sum += c;}
- if(sum == x){k++; break;}
- c++;
- }
- c = 1;
- sum = 0;
- }
- cout << "Res: " << k;
- }
- 5 - сумма же делителей по модулю?
- int main(){
- int P = 1, a, b, sum, x, c = 1;
- cin >> a;
- while(b!=1)
- {
- cin >> b;
- while(c!=b)
- {
- if(b%c==0){sum += c;}
- c++;
- }
- c = 1;
- if(a < 0 && sum < 10){P *= a;}
- sum = 0;
- a = b;
- }
- cout << "Res: " << P;
- }
- 6
- int main(){
- int n, sum=0, x, xt, S;
- cout << "Amount of numbers: ";
- cin >> n;
- for(int i = 1; i<=n; i++)
- {
- cin >> x;
- xt = abs(x);
- while(xt != 0)
- {
- sum += xt%10;
- xt /= 10;
- }
- if(sum == 10){S += x;}
- sum = 0;
- }
- cout << "Res: " << S;
- }
- 8
- int main(){
- int x, k=0, xt, sum;
- while(x != 2)
- {
- cin >> x;
- xt = abs(x);
- while(xt != 0)
- {
- sum += xt % 10;
- xt /= 10;
- }
- if(sum % 5 == 0){k++;}
- sum = 0;
- }
- if(k>=3){cout << "+";}else{cout << "-";}
- }
- 7
- int main(){
- int n, xt, x, k=0;
- cout << "Amount of numbers: ";
- cin >> n;
- for(int i = 1; i <= n; i++)
- {
- cin >> x;
- xt = abs(x);
- while(xt != 0)
- {
- if(xt%10 == 4){k++; break;}
- xt /= 10;
- }
- }
- if(k>=3 && k <= 5){cout << "+";}else{cout << "-";}
- }
- 9
- int main(){
- int x=1, sum, max=0, xt;
- while(x!=0)
- {
- cin >> x;
- xt = abs(x);
- while(xt!=0)
- {
- sum += xt%10;
- xt /= 10;
- }
- if(sum>14 && x>max){max = x;}
- sum = 0;
- }
- cout << "Res: ";
- cout << max;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement