+ 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;  } }

13th Aug 2017, 10:40 AM
SAPTHAGIRIVASAN
SAPTHAGIRIVASAN - avatar
4 Réponses
+ 5
Where is the main function? It must use to run the program. :/
13th Aug 2017, 10:51 AM
Nithiwat
Nithiwat - avatar
+ 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; }
13th Aug 2017, 12:58 PM
Daemo
Daemo - avatar
+ 1
it just the block of the program... what will be input?
13th Aug 2017, 10:53 AM
SAPTHAGIRIVASAN
SAPTHAGIRIVASAN - avatar
0
11
13th Aug 2017, 2:07 PM
SAPTHAGIRIVASAN
SAPTHAGIRIVASAN - avatar