Here's an example of two programs that do the same thing, I have been taught how to do them like the first way. Now, I'm reading an ebook and it explains to do them like the second way. Which way do you think is more proper?
thanks
#include <stdio.h>
int main()
{
[B]float convert(float);[/B]
float number,newnum;
puts("Please enter number");
scanf("%f", &number);
newnum=convert(number);
printf("Number by 2.5=%.2f", newnum);
return(0);
}
float convert(float number)
{
return(number*2.5);
}
#include <stdio.h>
[B]float convert(float number);[/B]
int main()
{
float number,newnum;
puts("Please enter number");
scanf("%f", &number);
newnum=convert(number);
printf("Number by 2.5=%.2f", newnum);
return(0);
}
float convert(float number)
{
return(number*2.5);
}