1. Beginner Question!

Im taking a C programming class in college and ive never had any previous experience programming. I got this assignment and i dont know how to do it. The assignment is Create a C file named numbers.c that accept as input from the keyboard 5 numbers. Calculate the following:Sum, Product and Average. Ok i went to my teacher for help and all she would tell me is that i am computing the sum before you receive the input from the
keyboard. HOw do i fix this? Here is my code:

#include <stdio.h>
int main()

{

int x,y,sum;
sum = x + y;

printf("Enter Two Numbers:");

scanf("%i %i",&x,&y);

printf("Sum:%i",sum);

return 0;
}

<< !! Posting Code? Read this First !! >>

as for your problem its fairly simple to fix:
Code:
```#include <stdio.h>
int main(void)

{

int x,y,sum;

printf("Enter Two Numbers:");

scanf("%i %i",&x,&y);
sum = x + y;
printf("Sum:%i",sum);

return 0;
}```

3. Ah yes,

Calculations are somewhat picky in C, or, shall I say, entirely. Analogy:

Question: There are x people in room A, and y people in room B, how many people are in all?

First things first:
· Find x and y [C: scanf()]
· Add the two [x + y]
· Result of how many people [x+y]

Do this in the wrong order, and a few problems occur.

· Add the two [x and y are just variable fronts, and aren't set yet]
· Find x and y [a little to late now]
· Result is still unknown

Hope this makes sense,
- Stack Overflow

4. Thanks

thanks so much...i was trying to figure that out forever. Thanks alot