Search
 
SCRIPT & CODE EXAMPLE
 

C

take array input from user and calc the avr in c

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

int main() {

    int sum, n, avr;
        scanf("%d",&n);
    int arr[n];
    for(int i=0; i<n ; i++){
        scanf("%d", &arr[i]);sum += arr[i];
    }
    avr=sum/n;
    /* printf("%d",sum); 
emove if u want to print the sum not avr*/
    printf("%d",avr);
return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: Returns number of values 
C :: not repeated serial number in c 
C :: wordpress clean name spaces 
C :: change variable type in c 
C :: pointers c 
C :: nosql injection 
C :: C what does /= mean 
C :: what is implicit typecasting 
C :: c constants 
C :: calendar in c 
C :: unox reclame harmonica tabs 
Dart :: debug banner flutter 
Dart :: flutter transparent appbar 
Dart :: flutter clear navigation stack 
Dart :: flutter print type 
Dart :: change padding in text field flutter 
Dart :: dart timestamp 
Dart :: dart timer delay 
Dart :: textfield height flutter 
Dart :: flutter path join 
Dart :: dart command to stop program 
Dart :: string to double fultter 
Dart :: how to replace commas in model array of strings in dart 
Dart :: final vs const dart 
Dart :: convert object to int flutter 
Dart :: retrieve shared preferences flutter map 
Dart :: what is final and const verabile in flutter 
Dart :: flutter check type of object 
Dart :: dart setters 
Dart :: input in dart 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =