Results 1 to 2 of 2

Thread: Compiler

  1. #1
    Join Date
    May 2004

    Unanswered: Compiler

    Pls if someone can compile me this program and check if it works since i need to send it now to a company because i don't have a compiler at home . I would be grateful

    #include <stdio.h>
    #include <stdlib.h>

    // For examle the user is to enter an integer

    main() {

    int sum=0;
    int number;
    int i;
    int mask=1;

    printf("Please enter an integer\n");
    scanf("%d", number);

    for (i=0; i< sizeof(int); i++) {
    if ( number & mask ) sum++;
    mask << 1;

    printf("The number of ones in %d is %d", number, sum);


  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    You really need to take this one into school and try it yourself. There are two minor syntax errors, one logic error, and one just plain old boo-boo. You've got the right idea though!


Posting Permissions

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