Program to generate numbers, finding average and largest values and rounding the largest to 100
Just a quick approach. It could be improved more. What you want is a way to reduce the two loops into one.

Some comments about the code: We initialized imax in order to reduce the if -else statement and also we combined the 2 foor loops in the end into one. What I would like to achieve even more is to reduce the final two for loops into one. But I think this is not possible for this case. But I might be wrong.

#include &lt;time.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main() {
    int sum = 0, imax = 0;
    int puan[10];
    srand(time(NULL));
    for(int i=0; i&lt;10; i++)
    {
        puan[i]=rand()%101;
        printf("%d. ogrencinin notu = %d \n",i+1,puan[i]);
        if(puan[i]&gt;imax) 
        {
            imax=puan[i];
        }
        sum += puan[i];
    }
    float avg=sum/10.0f;
    int fark = 100 - imax;
    printf("\nEn yuksek not = %d ve not ortalamasi %f.\n",imax,avg);
    printf("Her ogrencinin notuna %d puan eklendi.\n\n",fark);
    for(int i=0;i&lt;10;i++)
    {
        puan[i] += fark;
        if(puan[i]&lt;avg) 
        {
                printf("%d. ogrenci aldigi %d notuyla ortalamanin altinda kalarak dersten basarisiz olmustur.\n",i+1,puan[i]);
        }
    }

    return 0;
}