I'm practicing with a simple program for area calculating, but for some reason the program just skips the first 'if' condition and goes directly to the 'else' structure. Why though?
char t;
float a, b, h, area;
printf("Enter the type of your rectangle:\n R for right angled \n N for not right angled");
t = getchar();
if (t == 'R')
{
printf("Enter the legs of your triangle");
scanf("%f", &a);
scanf("%f", &b);
printf("The area of your triangle is:%f\n", area=(a*b)/2);
}
else
{
printf("Enter the height and the side of your triangle:");
scanf("%f", &h);
scanf("%f", &a);
printf("The area of your triangle is: %f\n", area=a*h/2);
}