Search
 
SCRIPT & CODE EXAMPLE
 

C

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 %d
",sum);
    
    //finding average
    printf("Average is %d
",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 %d
",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 %d
",min);
    
    
    
    
    
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: c syntax 
C :: read string with space c 
C :: CL/cl.h: No such file or directory 
C :: c language time() function 
C :: Hello world in C programming language 
C :: how to print sizes of various data types of C 
C :: factorial of a number in c 
C :: toupper function in c 
C :: c style string 
C :: C scanf() to read a string 
C :: array size in c 
C :: remove string from string c 
C :: bd number regex 
C :: round float in c 
C :: c program that replace vowels in a string with char 
C :: how to make a check bigger 
C :: printf("%3d ",XX); 
C :: qtableview get selected row 
C :: c print 2d array 
C :: best approach c menu terminal 
C :: delay in c programming for linux 
C :: input value from terminal to c 
C :: redis service 
C :: fifo in c 
C :: unused variable in c 
C :: insse suprafata arabila pe ani 
C :: cyrildewit laravel page view counter package. 
C :: how to find adam number uasing loop in C 
C :: best graphic video template for editing free download 
C :: worst fit program in c 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =