Problem with a simple program
Alright, I just started teaching myself how to program C a couple days ago, so don't make fun of me too much!
Code:
#include <stdio.h>
//purpous is to have 4 numbers input and the average displayed
main()
{
int a = 1; //counter
double b; //numbers to be input
double c = 0.0; //total of all b
char d; //suffix to number
while(a < 5)
{
printf("Input your %d%c number: ",a,d==1?'st':(a==2?'nd':(a==3?'rd':'th'))); //input numbers
scanf("%fl",&b); //input numbers to be averaged
c = c + b; //add all the numbers up
++a; //tell program to go to next number
if (a<5) continue; //if not done inputting numbers, loops
printf("The average of the 4 numbers is %fl.",c/4); //displays average of the sum of all 4 numbers inputted
}
return(0);
}
My problem is the program goes goofy when displaying the final averaged number. Does it have to do with the "Double"? Im getting a result a 0.0000001. Also it displays "t" at the end of each number when displaying which number to input.