# Thread: Basic problem - need help

1. ## Basic problem - need help

Hi,
I am really new to programming and trying to teach myself c and it's not easy! Could someone please tell me why this won't work. it's not finished yet still need to add the sqrt statement. I get stuck at the average calculations.
jasemca

Code:
```#include <stdio.h>
#include <math.h>

int main()
{
// Create two new integers to gather values
int a = 0;
int b = 0;
int a+b =c;

// Get me a number from the user (a)
printf("Enter a positive whole number.\n");
scanf("%d", &a);
printf ("You entered %d.\n", a);

// Get another number (b)
printf("Enter a positive whole number.\n");
scanf("%d", &b);
printf ("You entered %d.\n", b);

// Print the average
scanf("%f",c = (a+b)/2);
printf ("Average is: %f.\n", c);

// Print another math function

return 0;
}```

2. Yeah, that's wrong. I could point out all the errors, but I think you would do best to go over your tutorials/books again.

3. If you study your book(s)/tutorial(s) carefully, I'm sure you'll find the errors.
You are thinking too much math and too little computer/C.

4. ## thanks

Ok guys, thanks....I think! :-)

5. Originally Posted by jasemca
Hi,
I am really new to programming and trying to teach myself c and it's not easy! Could someone please tell me why this won't work. it's not finished yet still need to add the sqrt statement. I get stuck at the average calculations.
jasemca

Code:
```#include <stdio.h>
#include <math.h>

int main()
{
// Create two new integers to gather values
int a = 0;
int b = 0;
int a+b =c;   //not allowed and not needed
//just float c will do fine

// Get me a number from the user (a)
printf("Enter a positive whole number.\n");
scanf("%d", &a);
printf ("You entered %d.\n", a);
//to get  rid of the newline char still in the input buffer, you may use:
getchar();

// Get another number (b)
printf("Enter a positive whole number.\n");
scanf("%d", &b);
printf ("You entered %d.\n", b);

// Print the average
scanf("%f",c = (a+b)/2);  //this line is unnecessary
//or c = (a+b)/2;
printf("Average is: %f.\n", c);
printf ("Average is: %f.\n", (a+b/2);

// Print another math function

return 0;
}```
Revisions are in red. These are very basic concepts in C. If you don't have a good book, get one. If you have one, you should study it more.