Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
659 B
2
Indexable
Never
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int sayi1,sayi2;
    float ort=0;
    float toplam=0;
    int sayac=0;
    float asal=0;
    printf("Ilk sayiyi giriniz:");
    scanf("%d",&sayi1);
    printf("Ikinci sayiyi giriniz:");
    scanf("%d",&sayi2);
    for(int i=sayi1 ; i<sayi2 ; i++){
        for(int j=2 ; j<i ; j++){
            if(i%j==0){
                sayac++;
            }
        }
        if(sayac==0 && i>=2){
            printf("%d ",i);
            toplam=toplam+i;
            asal++;
        }
        else sayac=0;
    }
    ort=toplam/asal;
    printf("\n Ortalama: %f",ort);
    return 0;
}
Leave a Comment