how do i use scanf to read in one number and set it to two different variables?
how do i use scanf to read in one number and set it to two different variables?
You use it to read into one variable, then copy the value of that variable over to the other variable.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Is this what you mean?
If not, give an example.Code:scanf("%d",&i); j=k=i;
Last edited by BEN10; 11-22-2009 at 07:34 AM.
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
thats exactly what i mean. thank you very much.
i have made this to create part of a factorial table but i cant get it to only print the max factorial till it reaches the value entered for the minimum factorial. how would i go about that?Code:#include <stdio.h> void main() { int maxfactorial=0, minfactorial=0, line=0, factorial=0, i=0; printf("enter max factorial\n"); scanf("%d", &i); printf("enter min factorial\n"); scanf("%d", &minfactorial); printf("--------------------------------------------------------------------"); while (line<=0){ printf("\nFactorial Value Factorial expression Result"); line=line+1; } maxfactorial=i; factorial=i; while ( factorial>0){ printf("\n%d" ,maxfactorial); maxfactorial=maxfactorial-1; factorial=factorial-1; } }