list of c programs used for calculating average of numbers: c program to find average of n numbers using functions, c program to find average of n numbers using for loop and c program to find average of n numbers using while loop.

let see how to calculate average of n numbers.

average of 5 numbers 2,4,8,6,5 is

sum of all 5 digits/5 => ( 2+4+8+6+5)/5=25/5=5

5 is average of 5 no’s given above.

## write a C program to find average of n numbers using functions

write a C program find average of n numbers using functions

#include<stdio.h>

main()

{

int n,A[100];

printf(“How many numbers(n) you going to enter:”);

scanf(“%d”,&n);

printf(“\n Enter the numbers:”);

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

{

scanf(“%d”,&A[i]);

}

find_Average(A)

}

void find_Average(int m[100])

{

int i,a,n=0,s=0;

while(m[i]!=’\0′)

n++;

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

{

s=s+m[i];

}

a=s/n;

printf(“\n The average of n numbers is %d”, a);

}

## write a C program to find average of n numbers using for loop

write a c program to calculate average of n numbers using for loop

#include<stdio.h>

main()

{

int n,m[100],i,a,s=0;

printf(“How many numbers(n) you going to enter:”);

scanf(“%d”,&n);

printf(“\n Enter the numbers:”);

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

{

scanf(“%d”,&m[i]);

s=s+m[i];

}

a=s/n;

printf(“\n The average of n numbers is %d”, a);

}

OUTPUT:

How many numbers(n) you going to enter:5

Enter the numbers: 2 5 10 5 13

The average of n numbers is 7

## write a C program to calculate average of n numbers using while loop

write a C program to find average of n numbers using while loop

#include<stdio.h>

main()

{

int n,m[100],i,a,s=0;

printf(“How many numbers(n) you going to enter:”);

scanf(“%d”,&n);

printf(“\n Enter the numbers:”);

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

{

scanf(“%d”,&m[i]);

s=s+m[i];

}

a=s/n;

printf(“\n The average of n numbers is %d”, a);

}

OUTPUT:

How many numbers(n) you going to enter:5

Enter the numbers: 2 5 10 5 13

The average of n numbers is 7

## Other programs:

Static variable scope

Register variable scope

External variable scope

Automatic variable scope

amicable number

Prime number

Perfect number

Palindrome number

Strong number

Find Factorial

Biggest Number

Average of n numbers

decimal number to octal

convert decimal number to hexadecimal

decimal number to binary

simple interest

compound interest

Add sparce matrices

Add matrices

file copying

Palindrome string

Reverse string

String length

Replace characters in string

substring or not using arrays

First occurrence of character in string

Last occurrence of character in string

Convert to uppercase

Convert to lowercase

Concatenate strings

Compare strings

Generate Employee payslips

Count students scoring marks>50%

convert weight into grams