New Member
Group: Members
Posts: 12
Member No.: 43493
Joined: 25-April 11
|
Hey all, code peeps . Before we start, I have created this, yes actually wrote it, with the very appreciated assistance book "The C Programming Language, 2nd ed". however, i have been trawling the net a little to see if there is anything a bit special i could maybe try on it, only to my surprise........... this code, almost to the letter seems to be plastered everywhere, now im a beginner and firmly believe in learning they way i do, which somoetimes involves BOOKS, now i also have a bloody good idea that the net is a genius resource for beginners to veterans to MVP`s and alike. AND TO BE HONEST I PROBABLY SHOULD OF JUST GOOGLED IT AND DONE THE COPY AND PASTE SHUFFLE (*dont think i would understand as well, but thats just me i think, and anyway, why take the highroad, when the can get a move on when the road is predominantly downhill, no inferences intended here etc ) Anyway, in my inimitable long winded stylee, i just wanted to ask... ...DOES ANYBODY KNOW OF A CLEVER, INSIGHTFUL ROUTE I MIGHT TAKE WITH INSTIGATING A FACTOR FUNCTION IN C ? Im not good at c yet by a long shot but do like to enjoy the high road* and just wondered if there was a , dare I say it, next level approach. Please feel free to tell me to just be happy i got somewhere with it etc.... but if not , im all ears
CODE | #include<stdio.h> void findfactor(int num) { int i; for(i=1;i<num;i++) { if(num%i==0) printf("Factor for %d is %d\n",num,i); } } main() { int a; printf("\nEnter a number:"); scanf("%d",&a); findfactor(a); }
|
|