کامپیوتری ها
3.26K subscribers
4.41K photos
496 videos
476 files
467 links
Download Telegram
#برنامه_نویسی #آموزش_ابتدایی_c
#گرفتن_یه_تعداد_عدد_و_ذخیره_در_آرایه_و_مرتب_سازی_آنها_و_چاپ

#include<stdio.h>

//ba define dar kole barname
// 5 jaygozine size mishavad
#define size 5
void main()
{
double A[size],temp;
int i,j,maxInd;

printf("Salam @computeriha");
//######################
for (i=0;i<size;i++)
{
//lf=long float
scanf("%lf",&A[i]);
}

//########### Sort Sade #
// tashkhis max
//va bordane an be akhar
i=0;
while (i<size)
{
j=0;
maxInd=0;
while (j<size-i)
{
if (A[j]>A[maxInd])
maxInd=j;
j++;
}
// jabejayi max
temp=A[size-i-1];
A[size-i-1]=A[maxInd];
A[maxInd]=temp;
i++;
}
//#######################
for (i=0;i<size;i++)
{
printf("%f\n",A[i]);
}
}

🆔 @computeriha