// program to get total and percentage of a student
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<math.h>
void main()
{
int english,maths,physics,chemistry;
float total,percentage;
float total,percentage;
printf(“enter marks of different subjects \n”);
scanf(“%d%d%d%d”,&english,&maths,&physics,&chemistry);
total=english+maths+physics+chemistry;
percentage=(float)total/4; //called type casting to convert total/4 into floating value
percentage=(float)total/4; //called type casting to convert total/4 into floating value
printf(“the total marks is=%f\ and percentage=%f\n”,total,percentage);
getch();}
note:
you can also use like,
percentage=(float)(total/4);
or
percentage=float(total/4);
you get same output.