write a program to find maximum ,minimum ,sum and average of given number in c language.
#include<stdio.h>
#include<conio.h>
Void main( )
{
Int
i ,max,min ,sum=0;
Float
avg;
Int
num[10];
Printf(“enter
any 10 numbers :”);
For(i=0;i<10;i++)
{
Scanf(“%d”,&num[i]);
}
Max=num[0];
Min=num[0];
For(i=1;i<10;i++)
{
If(num[i]>max)
{
Max=num[i];
}
If(num[i]<min)
{
Min=num[i];
}
Sum=sum+num[i];
}
Avg=sum/I;
Printf(“maximum
number is %d “,max);
Printf(“minimum
number is %d “,minimum);
Printf(“sum
of the number %d “,sum);
Printf(“Average
of the number %f “,avg);
}
No comments
Post a Comment