C Program to Calculate Arithmetic Mean

#include<stdio.h>
#include<conio.h>
void main()
{
    clrscr();
    int num, i, arr[50], sum=0;
    printf("How many number you want to enter ?");
    scanf("%d",&num);
    printf("\n Enter %d Numbers :",num);
    for(i=1; i<=num; i++)
    {
        printf("\n Number %d=",i);
        scanf("%d",&arr[i]);
        sum=sum+arr[i];
    }
    int armean=sum/num;
    printf("\n Arithmetic Mean = %d",armean);
    getch();
}

Run:

No comments:

Post a Comment

100 C Programs with Code and Output

Program 1: C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. Program 2: C Program To Read Three Numbers And Prin...