+ 1
what will be input?
For example, the function should return 1 if n = 22 or n = 24, and it should return 0 if n = 23 or n = 42. Give a value of n for which the given function does NOT work. int check(int n) { int m = n; int digit; int count = 0; while(m > 0) { digit = m % 10; m = m / 10; if(n % digit == 0) { count++; } } if(count >= 2) { return 1; } else { return 0; } }
4 ответов
+ 5
Where is the main function?
It must use to run the program. :/
+ 2
found full code on the web
#include <stdio.h>
int check(int n) {
int m = n;
int digit;
int count = 0;
while(m > 0) {
digit = m % 10;
m = m / 10;
if(n % digit == 0) {
count++;
}
}
if(count >= 2) {
return 1;
} else {
return 0;
}
}
int main(void) {
// your code goes here
printf(check(10));
return 0;
}
+ 1
it just the block of the program... what will be input?
0
11