hi,
If you remove second scanf("%c"), it works fine.
my question is what is the purpose of using scanf("%c",) there?
--- koti
--- On Mon, 11/17/08, Brett McCoy <[EMAIL PROTECTED]> wrote:
From: Brett McCoy <[EMAIL PROTECTED]>
Subject: Re: [c-prog] 200=10? 2000=1802? 20000=19978?
To: [email protected]
Date: Monday, November 17, 2008, 8:07 PM
On Mon, Nov 17, 2008 at 8:56 PM, boogiebehometh
<boogiebehometh@ gmail.com> wrote:
> Basically, I scan in a number & print it to screen - large numbers
> become slightly smaller & small numbers become 10.
>
> 200 becomes 10
> 2000 becomes 1802
> 20000 becomes 19978
> 200000 becomes 199946
>
> I'm using the Dev C++ Compiler Version 4.9.9.2
> unsigned long is shown here, but i get the same results with int &
> long...
>
> Here's the code:
>
> #include <stdio.h>
> #include <string.h>
>
> int l;
> int main ()
> {
> int l;
> unsigned long trTime=0, trTime2=0, step=0;
>
> printf("\nEnter Transition Time(%cs): ",230);
> scanf("%d",& trTime);
> scanf("%c");
> printf("\nTransitio n time = %d%cs\n", trTime, 230);
> getchar();
> return 0;
> }
It works correctly if you remove the second scanf(). Not sure what
that is there for, but it doesn't do a darn thing (think about if you
used printf() with a format but no parameters for the format).
-- Brett
------------ --------- --------- --------- --------- --------- -
"In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world."
-- Jelaleddin Rumi
[Non-text portions of this message have been removed]