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

int main() {
    int n,i,Estud=0,Ostud=0;
    float Even=0,Odd=0;
    scanf("%d",&n);
    if(n>10){
        printf("Wrong Input");
        return 0;
    }
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        if ((a[i]<2)||(a[i]>100)){
            printf("Wrong Input");
            return 0;
        }
    }
    for(i=0;i<n;i++){
        if((i+1)%2==0){
            Even=Even+a[i];
            Estud++;
        }else{
            Odd=Odd+a[i];
            Ostud++;
        }
    }
    printf("\nEven number of students = %d",Estud);
    printf("\nOdd number of students = %d",Ostud);
    printf("\n Odd Average = %.2f ,Even average = %.2f",(Odd/Ostud),(Even/Estud));
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: