current position:Home>For someone, delete return 1 and return 0

For someone, delete return 1 and return 0

2022-01-27 05:59:00 CSDN Q & A

#include<stdio.h>
#include<math.h>
int prime(int m) {
int i, k;
if(m != 0)
k = (int)sqrt(m);
for ( i = 2; i <= k; i++) {
if (m % i == 0)
break;
}
if(i > k)
return 1;
else
return 0;
}
int super(int u) {
while(u != 0) {
if(prime(u)) {
u /= 10;
} else {
return 0;
}
}
return 1;
}
int main() {
int n;
scanf("%d", &n);
if(super(n)) {
printf("Yes");
} else {
printf("No");
}
return 0;
}




Refer to the answer 1:

Method before int All for void, And then put return All delete




Refer to the answer 2:



Refer to the answer 3:

For reference :

#include<stdio.h>void prime(int *m){    int i;    if(*m <= 1){       *m = 0;       return;    }    if(*m == 2 || *m == 3){       return;    }    for (i = 2; i*i <= *m; i++) {       if (*m % i == 0){           *m = 0;           break;       }    }    return;}void super(int *u){    int N;    if(*u <= 0){       *u = 1;       return;    }    while(*u != 0) {         N = *u;         prime(&N);         if(N != 0) {            *u /= 10;         }         else {            break;         }    }    return;}int main(){    int n;    scanf("%d", &n);    super(&n);    if(n==0) {       printf("Yes");    }    else {       printf("No");    }    return 0;}



Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270558592590.html

Random recommended