Hi all,
I am a rank beginner to programming and have been following along to a couple of tutorials. I feel like I have a decent grip on the basics and decided to go solo and attempt a very simple program.
What I thought I would do is create a program to calculate batting average. Simple right? hits/at bats. Well I get no errors when compiling but it just doesn't calculate properly. I'm guessing it has something to do with the at-bats being the larger number. Any tips or pointers would be much appreciated, and here is the code (please be kind!) that I've written
Thanks
Mike
Code:
#include <stdio.h>
#include <conio.h>
int main()
{
int hits;
int atbats;
float bavg;
scanf("%d%d", &hits, &atbats);
bavg = hits/atbats;
printf("%f", bavg);
getch();
return 0;
}