Ответ:
int n, bits;
cin >> n;
bits = 0;
do { bits |= 1 << n % 10; } while(n /= 10);
cout << (bits & bits - 1 ? "no" : "yes");
Объяснение:
#include <stdio.h>
int num(int a){
int cur = 0;
int i = 0;
int arr[10000];
while(a!=0){
cur = a%10;
arr[i] = cur;
a/=10;
i++;
}
for(int j = 0;j<i-1;j++){
if(arr[j] != arr[j+1]){
printf("number consists of different numbers \n");
return 0;
printf("number consists of same numbers ");
int main()
{
int number = 0;
printf("Enter number: ");
scanf("%d",&number);
num(number);
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
int n, bits;
cin >> n;
bits = 0;
do { bits |= 1 << n % 10; } while(n /= 10);
cout << (bits & bits - 1 ? "no" : "yes");
Объяснение:
Ответ:
#include <stdio.h>
int num(int a){
int cur = 0;
int i = 0;
int arr[10000];
while(a!=0){
cur = a%10;
arr[i] = cur;
a/=10;
i++;
}
for(int j = 0;j<i-1;j++){
if(arr[j] != arr[j+1]){
printf("number consists of different numbers \n");
return 0;
}
}
printf("number consists of same numbers ");
return 0;
}
int main()
{
int number = 0;
printf("Enter number: ");
scanf("%d",&number);
num(number);
return 0;
}
Объяснение: