+ 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 Answers
+ 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