Code:# include <stdio.h> # include <math.h> int main () { int num,mod; printf("Please enter a number:\n"); scanf("%d",&num); while (num>=10) { mod=num%10; num=(num-mod)/10; printf("%d", &mod); } printf("%d", &num); return 0; }
Code:# include <stdio.h> # include <math.h> int main () { int num,mod; printf("Please enter a number:\n"); scanf("%d",&num); while (num>=10) { mod=num%10; num=(num-mod)/10; printf("%d", &mod); } printf("%d", &num); return 0; }
So what is not working?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
It's only for scanf() that you need to use & on (basic) variables. With printf(), you don't want to.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Yes, eventually I got it myself... same mistake as last time
Thanks Elysia for the interesting information about what "&" actually means.
thank you all!