Ask Question
2 November, 14:58

Write a C program to compute the average age of nth student

+4
Answers (1)
  1. 2 November, 15:30
    0
    Following are the code in c language

    #include / / header file

    int main () / / main function

    {

    int n1, i;

    float avg, x, s=0; / / variable declaration

    printf ("/nEnter How many Number terms you want:");

    scanf ("%d",&n1); / / input terms by user

    for (i=0; i
    {

    scanf ("%f",&x); / / user input

    s = s + x; / /calculate sum

    }

    avg = s/n1; / / calculate average of n number

    printf ("/nThe average of n number is:");

    printf ("%f", avg); / / display average

    return 0;

    }

    Output

    Enter How many Number terms you want:3

    3

    4

    3

    The average of n number is:3.333333
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a C program to compute the average age of nth student ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers