Friday 19 February 2016

Take the average of Three Numbers Using C And Functions

#include <stdio.h>
#include <stdlib.h>

//Function of average of numbers
int averagenumbers(int a, int b, int c);

int main()
{
    int n1,n2,n3;
    printf("Enter The Three Numbers : ");
    scanf("%d",&n1);
    scanf("%d",&n2);
    scanf("%d",&n3);
    averagenumbers(n1,n2,n3);//Function Calling.
    return 0;
}

//Function Prototype.
int averagenumbers(int a, int b, int c)
{
    int avg=(a+b+c)/3;
    printf("The average Of given numbers is : %d",avg);
    return 0;
}

No comments:

Post a Comment