Program to input three number and calculate their Average.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,m=0;
clrscr();
printf("Enter three number=");
scanf("%d%d%d",&a,&b,&c);
d=(a+b+c)/3;
printf("Average=%d",d);
getch();
}
OUTPUT
Note:- If you want to calculate floating value (value which contains point) or fractional value ,you can use "float " and "%f" replace to "int " and "%d". If you want to calculate both use "double".
#include<conio.h>
void main()
{
int a,b,c,m=0;
clrscr();
printf("Enter three number=");
scanf("%d%d%d",&a,&b,&c);
d=(a+b+c)/3;
printf("Average=%d",d);
getch();
}
OUTPUT
Note:- If you want to calculate floating value (value which contains point) or fractional value ,you can use "float " and "%f" replace to "int " and "%d". If you want to calculate both use "double".
Comments
Post a Comment