Answers for "c program to find minimum and maximum number and average in an array"

C
0

sum average min max in c array

#include <stdio.h>


int main(){
    int i,sum=0;
    //declaring array
    int score[7] = {67,55,98,88,90,76,89};
    //finding sum of the array numbers
    for(i = 0; i < 7; i++){
        sum = sum + score[i];
    }
    
    printf("Sum is %dn",sum);
    
    //finding average
    printf("Average is %dn",sum/7);
    
    //finding max number
    int max=score[0];
    for(i = 0; i < 7; i++){
        if(score[i] > max){
            max = score[i];
        }
    }
    
    printf("Max number is %dn",max);
    
    //finding min number
    int min=score[0];
    for(i = 0; i < 7; i++){
        if(score[i] < min){
            min=score[i];
        }
    }
    printf("MIn number is %dn",min);
    
    
    
    
    
    return 0;
}
Posted by: Guest on July-13-2021

Code answers related to "c program to find minimum and maximum number and average in an array"

Code answers related to "C"

Browse Popular Code Answers by Language