Tuesday, March 5, 2024

41. Sum an average of n numbers :—

 41. Sum an average of n numbers :—


#include<stdio.h>

int main()

{

    int i,sum,n,k,m;

    printf("enter a value of n ");

    scanf("%d",&n);

    sum=0;

    for(i=1;i<=n;i++)

    {

        printf("enter a value ");

        scanf("%d",&m);

        sum=sum+m;

    }

    k=sum/n;

    printf("%d    %d",sum,k);

    return 0;

}


No comments:

Post a Comment