Created
March 28, 2013 21:40
-
-
Save gokhanyavas/5267047 to your computer and use it in GitHub Desktop.
Dışardan girilen n adet sayının aritmetik sayının aritmetik ortalamasını bulan c programı
This file contains 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
//dışardan girilen n adet sayının aritmetik sayının aritmetik ortalamasını bulan program | |
#include <stdio.h> | |
#include <conio.h> | |
int main() | |
{ | |
int i,sayi; | |
float n,toplam,ortalama; | |
printf("Lütfen sayı miktarini giriniz : \n"); | |
scanf("%f",&n); | |
toplam = 0; | |
for (i=1; i<=n; i++ ) | |
{ | |
printf("%d . sayi giriniz :",i); | |
scanf("%d",&sayi); | |
toplam = toplam + sayi; | |
} | |
ortalama = toplam /n; | |
printf("Girilen sayilarin aritmetik ortlamasi: %f", ortalama); | |
getch(); | |
// ekranın kapanmasını engelliyor.. | |
} | |
#include <stdio.h>
#include <conio.h>
int main()
{
int i,a,c;
printf("Lutfen Sayi Miktarini Giriniz=");
scanf("%d",&a);
float s[a],g=0.0;
for(i=0,c=1;i<a && true;i++,c++) {
printf("%d. Sayi=",c);
scanf("%f",&s[i]);
g +=s[i];
}
printf("Sonuc=%.2f",g / a);
getch();
return 0;
}
int main(int argc, char** argv) {
//Dışarıdan girilen n adet sayının aritmetik ortalamasını bulan c programı
int i, sayi;
float sayimiktari,toplam,ortalama;
printf("Lutfen sayi miktarini giriniz: \n");
scanf("%f",&sayimiktari);
toplam=0;
for (i=1; i<=sayimiktari; i++)
{
printf("%d. sayiyi giriniz: \n",i);
scanf("%d",&sayi);
toplam=toplam+sayi;
ortalama=toplam/sayimiktari;
}
printf("Girilen sayilarin aritmetik ortalamasi: %f",ortalama);
return 0;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wrong sentence