Hi everyone! When I take the help of pointers,by keeping the return type of the function as void,the program works fine,but when I try to pass the values to the function and use return type as double.It only displays the interger part,even after typecasting.
Code:#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; }