In: Computer Science
C code:
#include <stdio.h>
//function PhoneType
double PhoneType(char phone){
//checking if phone has A or a
if(phone=='A' || phone=='a')
//returning 1099.99
return 1099.99;
//checking if phone has S or s
else if(phone=='S' || phone=='s')
//returning 999.99
return 999.99;
else
//returning 0.0
return 0.0;
}
int main()
{
//calling PhoneType function for a sample value and printing
result
printf("%.2lf",PhoneType('A'));
return 0;
}
Screenshot:
Output: