In: Computer Science
Source code:
#include <stdio.h>
double PhoneType(char phone)
{
double val=0.0;
if(phone=='a' || phone=='A')
{
printf("Apple\n");
val=1099.99;
}
else
{
val=0.0;
}
return val;
}
int main()
{
printf("Calling with parameter 'a'\n");
printf("%lf\n",PhoneType('a') );
printf("\nCalling with parameter 'A'\n");
printf("%lf\n",PhoneType('A') );
printf("\nCalling with parameter 'z'\n");
printf("%lf\n",PhoneType('z') );
}
Sample input and output: