#include<stdio.h>
#include<math.h>
main()
{
int a,b,c;
float sum,avg,variance,sd;
printf("Enter a value for first number\t:");
scanf("%d",&a);
printf("Enter a value for second number\t:");
scanf("%d",&b);
printf("Enter a value for third number\t:");
scanf("%d",&c);
/*a.sum*/
sum=a+b+c;
printf("\n\ta.Sum:%.2f\n",sum);
/*b.Average*/
avg=sum/3;
printf("\n\tb.Average:%.2f\n",avg);
/*c.Min*/
if(a<b)
{
if(a<c)
printf("\n\tc.Min:%d",a);
else
printf("\n\tc.Min:%d",c);
}
else
{
if(b<c)
printf("\n\tc.Min:%d",b);
else
printf("\n\tc.Min:%d",c);
}
/*d.Max*/
if(a>b)
{
if(a>c)
printf("\n\td.Max:%d",a);
else
printf("\n\td.Max:%d",c);
}
else
{
if(b>c)
printf("\n\td.Max:%d",b);
else
printf("\n\td.Max:%d",c);
}
/*e.Variance*/
variance=(pow((a-avg),2)+pow((b-avg),2)+pow((c-avg),2))/3;
printf("\n\te.Variance:%.2f\n",variance);
/*f.Standard deviation*/
sd=sqrt(variance);
printf("\n\tf.Standard Deviation:%.2f\n",sd);
}
#include<math.h>
main()
{
int a,b,c;
float sum,avg,variance,sd;
printf("Enter a value for first number\t:");
scanf("%d",&a);
printf("Enter a value for second number\t:");
scanf("%d",&b);
printf("Enter a value for third number\t:");
scanf("%d",&c);
/*a.sum*/
sum=a+b+c;
printf("\n\ta.Sum:%.2f\n",sum);
/*b.Average*/
avg=sum/3;
printf("\n\tb.Average:%.2f\n",avg);
/*c.Min*/
if(a<b)
{
if(a<c)
printf("\n\tc.Min:%d",a);
else
printf("\n\tc.Min:%d",c);
}
else
{
if(b<c)
printf("\n\tc.Min:%d",b);
else
printf("\n\tc.Min:%d",c);
}
/*d.Max*/
if(a>b)
{
if(a>c)
printf("\n\td.Max:%d",a);
else
printf("\n\td.Max:%d",c);
}
else
{
if(b>c)
printf("\n\td.Max:%d",b);
else
printf("\n\td.Max:%d",c);
}
/*e.Variance*/
variance=(pow((a-avg),2)+pow((b-avg),2)+pow((c-avg),2))/3;
printf("\n\te.Variance:%.2f\n",variance);
/*f.Standard deviation*/
sd=sqrt(variance);
printf("\n\tf.Standard Deviation:%.2f\n",sd);
}
No comments:
Post a Comment