ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1014. Product of Digits

Compilation error
Posted by Levan Arabuli (Tbilisi SU) 19 Feb 2011 01:07

#include <stdio.h>

const int M=99999999;
bool fun(int a,int b);

int main(){
    int N;
    scanf("%d",&N);
    int i;
    int Q=1;
    for(i=0;i<M;i++){
                     if(fun(i,N)==1){
                                     printf("%d",i);
                                     break;
                                     }
                     if(i==M-1){ printf("%d",-1);
                      break;}
            }


}


bool fun(int a,int b){
     int sum=1;
     while(a){
              sum*=a%10;
              a/=10;
              }
     if(sum==b) return 1;
     else return 0;
     }


why I get compil.error?

in Dev-C++ it works :(
Re: Compilation error
Posted by Michael 14 Mar 2011 20:32
Bool is not included in the standard C99.
You need to change "bool" in "int".