Created
March 22, 2013 21:06
-
-
Save austa/5224735 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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