Results 1 to 2 of 2

Thread: printf error

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    printf error

    i am playing around with printf.

    PHP Code:
    #include <stdio.h>

    int main()
    {
        
    int abc;

        
    printf ("Input 2 integers separated by a comma:\n");
        
    scanf ("%i %i", &a, &b);
        
        
    b;

        if (
    == b)
        {
            
    printf ("%i is equal to %i.\n"ab);
            
    printf ("and their sum is even\n");
        }
        else if (
    b)
        {
            
    printf ("%i is less than %i.\n"ab);
                if (
    c%== 0)
                    
    printf ("and their summ is even.\n");
                else
                    
    printf ("and their sum is odd.\n");
        }
        else
        {
            
    printf ("%i is greater than %i.\n"ab);
                if (
    c%== 0)
                    
    printf ("and their sum is even.\n");
                else
                    
    printf ("and their sum is odd.\n");
        }

            return 
    0;

    the problem is that b is always equal to
    -858993460..i dont get it...i checked the format specifiers but they are right
    thanks
    Amon Ra
    The Power of Learning.

  2. #2

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    sorry about that..i removed the comma when entering the character, and it worked
    Amon Ra
    The Power of Learning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width