编辑代码

#include <stdio.h>
int main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
    //printf("Hello world!     - c.jsrun.net.");
    void reverse(int a[],int len,int p){
        int s[p];
        for(int i=0;i<p;i++){
            s[i]=a[i];
        }
        for(int j=p;j<len;j++){
            a[j-p]=a[j];
        }
        int m=0;
        for(int k=len-p;k<len;k++ ){
            a[k]=s[m++];
        }
    }
    int a[]={1,2,3,4,5,6,7};
    int p;
    scanf("%d",&p);
    reverse(a,7,p);
    for(int i=0;i<7;i++){
        printf("%d ",a[i]);
    }
    
    
    return 0;
}