Weight Conversion Program
Hi guys,
I started my programming class at college today and the first task is to create a program to convert kilograms to stone and pounds and pounds and stones to kilos. Im working on the first one now and so far I have this:
Code:
#include <stdio.h>
int main ()
{
float a;
printf ("Kilograms to Stones and Pounds Program \n Enter the amount in Kilograms");
scanf ("%f",a);
a = a / 2.2;
printf ("%f",a);
getchar();
getchar();
return 0;
}
I take the number they enter, divide it by 2.2 to convert it to pounds and kilos and then print the result. I use floating point variables so I can have a more accurate answer outputted.
However when I run it, and type a number in it crashes. The debug on Dev C++ says, An Access Violation (Segmentation Fault) raised in your program. Any ideas?