Check out example codes for "double return type in c". It will help you in understanding the concepts better.

Code Example 1

#include<stdio.h>
double cal_per(int, int, int);
int main()
{
  int a = 55, b = 66, c = 77;
  double res;  
  res = cal_per(a,b,c);
  printf("%f\n",res);
  return 0;
}
double cal_per(int a, int b, int c)
{
  double res;
  res = (a+b+c)/300.0;
  res *= 100;
  return res;
}

Learn ReactJs, React Native from akashmittal.com