int persistence( int input ) { if( input < 10 ) { return 0; } else { int digit = reducer( input ); return 1 + persistence( digit ); } }
int main(int argc, char* argv[]){ int x; int y; printf("Enter a number then generate an EOF:"); while(scanf("%d", &x)!=EOF) y=persistence(x); printf("The persistence of that number is: %d\n", y); return 0; }
int counter( int num ){ if( num < 10 ){ return 0; }else{ num = persistence( num ); return( 1 + counter( num ) ); } }
int main( int argc, char* argv[] ) { int n = 0; int y = 0; while( n != EOF) { /* Scans in new numbers unless EOF is entered */ printf("\nEnter a number to check the persistence:\n"); scanf("%d", &n); y = persistence(n); /* Passes entered number to function */ printf("\nThe persistence of the number is: %d\n", y); } return 0; }
int persistence( int num ){ int x; if( num < 10 ){ return num; }else{ x = num % 10; return( x * persistence( num/10 )); } }
void loop(void){ int x, persist; printf("Please insert a number:\n"); if ( scanf("%d",&x)==EOF){ printf( "EOF entered by user\n"); return; } else { persist = persistence(x); printf("The persistence is:%d\n", persist); } return loop(); }
void EOF_scan( int num ) { int output; if( num != EOF ) { output = persistence( num ); printf( "%d\n", output ); scanf( "%d", &num ); return EOF_scan( num ); } else { return; } }
// runs the configuration associated with the given string void run_config( const char_type * str) const { Private::lock_type locker( m_cs); // by default, no persistence; however, the config // we're currently running, can override this. persistence().clear_persistence_stream(); configs_collection::const_iterator found = m_configs.find( str); if ( found != m_configs.end() ) // run the function (found->second).run_config(); else assert_settings().get_dumper() << "[SMART_ASSERT logical error] " "configuration " << str << " not found!" << std::endl; }
int main( int argc, char * argv[] ){ int x,i; printf( "Enter a number to find its persistence:" ); if(scanf( "%d",&x) == EOF ){ return EOF; } else { printf( "Persistence is:%d", persistence(x,i) ); printf( "\nPlease enter another number:%d\n", i ); } void get_input();{ return 0; } }
int main( int argc, char *argv[] ){ int num, answ; printf( "Enter a number: \n" ); while ( scanf( "%d", &num) != EOF ){ answ = persistence( num ); printf( "The persistence of %d is: %d\n", num, answ ); } return 0; }
int main( int argc, char *argv[]) { int number; int x; printf("Please enter the integer of which you wish to know the persistence: \n"); /* prompts the user for an integer */ scanf("%d", &number); /* scans said integer into the variable number */ while(getchar() != EOF){ /* runs the loop until EOF is reached */ x = persistence(number); /* calls the persistence function to calculate the persistence of the number */ printf("%d\n", x); /* prints the persistence of the number */ scanf("%d", &number); /* scans in the next integer which the user inputs in order to repeat the process */ } return 0 ; }
int main (int argc, char* argv []) { int x=0,y=0; printf( "\nEnter a number or EOF: " ); while ( scanf( "%d", &x ) != EOF ){ y = persistence ( x ); printf( "The persistence of %d is: %d\n", x , y ); printf( "\nEnter a number or EOF: " ); } putchar ('\n'); return 0; }
// --------------------------------------------------------------------------------- ReportTypeList ReportManager::findAll() { ReportTypeList list; persistence().findAll ( list ); return list; }
// --------------------------------------------------------------------------------- TaskList TaskManager::findAll() { TaskList list; persistence().findAll(list); return list; }
int persistence (int num ){ /* this function takes an integer, returns the */ if (num <= 9) /* persistence of this integer. */ return 0; return 1 + persistence(product (num)); }
// --------------------------------------------------------------------------------- ProjectList ProjectManager::findAll() { ProjectList list; persistence().findAll(list); return list; }
// --------------------------------------------------------------------------------- TemplateList ActionTemplateManager::allTemplates() { TemplateList list; persistence().findAll(list); return list; }