Skip to content

Instantly share code, notes, and snippets.

@austa
Created March 22, 2013 21:06
Show Gist options
  • Save austa/5224735 to your computer and use it in GitHub Desktop.
Save austa/5224735 to your computer and use it in GitHub Desktop.
/*
* File: main.c
* Author: alaattin
*
* Created on 22 Mart 2013 Cuma, 22:41
*/
#include <stdio.h>
#include <stdlib.h>
#define NOTSAYISI 10
/*
*
*/
void listeye_At(int*, int);
double ortalama_Bul(int*, int);
int main(int argc, char** argv) {
int notlar [NOTSAYISI] = {};
int* p = notlar;
listeye_At(p, NOTSAYISI);
printf("Girilen notlarin ortalamasi %.2f 'dir. \n", ortalama_Bul(p, NOTSAYISI));
return (EXIT_SUCCESS);
}
void listeye_At(int* p, int sayi) {
int i = 0;
for(i = 0; i < sayi; i++){
printf("%d. notu giriniz: \n", i+1);
scanf("%d", p++);
}
}
double ortalama_Bul(int* p, int sayi){
int i = 0;
double toplam = 0;
for(i = 0; i < sayi; i++){
toplam += *(p++);
}
return (double) toplam / (double) sayi;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment