To find the average of first n natural numbers

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int n, i;
    float sum = 0, avg;
    clrscr();
    printf("Enter the limit : ");
    scanf("%d", &amp;n);
    for(i = 1 ; i <= n ; i++)
    sum = sum + i;
    avg = sum / n;
    printf("\nAverage of first %d numbers is : %.2f", n, avg);
    getch();
}

Output:

Enter the limit : 5
Average of first 5 numbers is : 3.00