Here i have correct your program, I hope it will satisfied you

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

//declaration
void head( );
float convert (float);

void main() //main
{
float dollar, peso;
head();
printf ("\n\tPlease enter the dollar: $"); scanf("%f",&dollar);


peso = convert(dollar);  //function calling with argument dallar
 
//You have to pass dollar variable to fuction so fuction can calculate it
 
 printf("\n\n\t\t$%.2f is equal to PH%.2f pesos.", dollar, peso);
 getch();
}


void head ()
{
 printf ("\n\t\t<<Function to convert dollars to pesos using function.>>\n");
}

 float convert(float d)
{
 float p;
 p = d*46; //computation to convert dollar to peso
 
 // Here, you are simply setting p to 46. You want to use the passed argument; 
p = d * 46.00;
 
 return p; // returns the value of p to main function which will be stored in 
peso 
  
}


Reply via email to