Write a function to return the trip cost which calculated using the given distance in kilometers. Note: Take 35 LKR as travelling cost per kilometer.
Answer next
#include<stdio.h>
float Tripcost( );
float Tripcost( )
{
float km;
printf("Enter the Travelling km : ");
scanf("%f",&km);
return 35 * km;
}
int main ()
{
float x;
printf("Trip cost : %.2f",Tripcost(x));
return 0;
}

0 comments:
Post a Comment