Thread: Help! Werd output

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    3

    Question Help! Werd output

    /*Any one that can help me with this program?
    What ever the input is the output is wrong:

    How many sisters do you have: 2
    How many brothers do you have: 1
    You have 37814104 sisters and 37814112 borthers */
    Code:
    #include <stdio.h>
    
    int main()
    {
          int sisters;
          int brothers;
    
          printf("How many sisters do you have: ");
          scanf("%d", &sisters);
          printf("How many brothers do you have: ");
          scanf("%d", &brothers);
          printf("You have %d sisters and %d borthers\n"), brothers, sisters;
    
          fflush (stdin);
          getchar ();
    }

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    1. See the FAQ about flushing stdin
    2. The bracket
    Code:
    printf("You have &#37;d sisters and %d borthers\n"), brothers, sisters;
    Is in the wrong spot

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    3
    nop did not do it.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    3
    ups.. sorry. it did. just me trying with the "old" program

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Post you new code...

    [edit]
    nevermind
    [/edit]

  6. #6
    Registered User
    Join Date
    Oct 2008
    Posts
    28
    Code:
    printf("You have&#37;d sisters and%d brothers\n", sisters, brothers)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help for my output array
    By qwertysingh in forum C Programming
    Replies: 1
    Last Post: 02-17-2009, 03:08 PM
  2. execl()/fork() output
    By tadams in forum C Programming
    Replies: 19
    Last Post: 02-04-2009, 03:29 PM
  3. Replies: 4
    Last Post: 11-30-2005, 04:44 PM
  4. Formatting output into even columns?
    By Uncle Rico in forum C Programming
    Replies: 2
    Last Post: 08-16-2005, 05:10 PM
  5. Output problems with structures
    By Gkitty in forum C Programming
    Replies: 1
    Last Post: 12-16-2002, 05:27 AM

Tags for this Thread