#include"stdio.h"voidmain(){double a=2;//分子double b=1;//分母double sum=0;//和值double temp=0;//临时变量 int i;for(i=1;i<=20;i++){
sum+=a/b;
temp=a;
a+=b;
b=temp;}printf("the result is :%.2f\n",sum);}
#include"stdio.h"voidmain(){int arr[10];int i,j,temp;printf("please input the arr:\n");for(i=0;i<10;i++)scanf("%d",&arr[i]);for(i=1;i<10;i++)for(j=0;j<10-i;j++)if(arr[j]>arr[j+1]){
temp=arr[j+1];
arr[j+1]=arr[j];
arr[j]=temp;}printf("the result is :\n");for(i=0;i<10;i++)printf("%d ",arr[i]);}
#include"stdio.h"voidmain(){int arr[10];int i,j;int temp;printf("please input the arr:\n");for(i=0;i<10;i++)scanf("%d",&arr[i]);for(i=0,j=9;i<5;i++,j--){
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;}printf("the result is :\n");for(i=0;i<10;i++)printf("%5d",arr[i]);}