#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
float avg;
printf("\n Enter two numbers : ");
scanf("%d %d",&a,&b);
avg=(a+b)/2;
printf("\n Average = %f ",avg);
getch();
}
NOTE:= In this program the average of two numbers may come in fraction. So we take "avg" variable as of float(floating point) data type.
#include<conio.h>
void main()
{
int a,b;
float avg;
printf("\n Enter two numbers : ");
scanf("%d %d",&a,&b);
avg=(a+b)/2;
printf("\n Average = %f ",avg);
getch();
}
NOTE:= In this program the average of two numbers may come in fraction. So we take "avg" variable as of float(floating point) data type.
No comments:
Post a Comment