write a program to find and display the sun and average of four numbers by using function argument
Answers
Answered by
0
Answer:
hint
Explanation:
use logical method
Answered by
0
Answer:
#include <stdio.h>
#include <conio.h>
int main()
{
int n,*p,sum=0,i;
float avg;
printf("How many numbers u want :: ");
scanf("%d",&n);
p=(int *) malloc(sizeof(int));
if(p==NULL)
{
printf("\nMemory Allocation unsuccessful.\n");
exit(0);
}
for(i=0;i<n;i++)
{
printf("\nEnter Number %d :: ",i+1);
scanf("%d",p+i);
}
for(i=0;i<n;i++)
{
sum=sum+*(p+i);
}
printf("\nThe Sum of %d Numbers is %d \n",n,sum);
avg=(float)sum/n;
printf("\nThe Average of %d Numbers is %0.2f \n",n,avg);
return 0;
}
Explanation:
MARK ME AS BRAINLIEST
Similar questions