i have written code to find average and percentage using function and pointer. but the output is going wrong.
example - average for 50, 50 and 51 is 50.
example - average for 50, 50 and 51 is 50.
#include<stdio.h> #include<conio.h> void avgper (int,int,int,float *,float *); main () { int i,j,k; float per,avg; printf("\t\t LUC - 5 - d - f - c - average and percentage in one fuction\n\n"); printf("Enter your three subjects marks "); scanf("%d %d %d",&i,&j,&k); avgper (i,j,k,&per,&avg); printf("\nYour average marks = %f",avg); printf("\nYour percentage = %f",per); getch(); } void avgper (int i,int j,int k,float *l,float *m) { *l=(i+j+k)*100/300; *m=(i+j+k)/3; }
