编辑代码

#include <stdio.h>
int main () {
    int a;
    printf("?");
    printf("菱形的对角线长是:");
    scanf("%d",&a);
    int l , m , n;
    l = 1;
    m = (a+1)/2 ;
    n = a ;
    int b ;
    int x = 1;

    while(n>0){
            b=(m-l)*(m-l);
            while(x*x<=b){
                printf(" ");
                x++;
            }
            x = 1 ;
            x = a ;
            int c = 0;
            while(((x-c)*(x-c))>4*b){
                printf("*");
                c=c+1;
            }
            x = 1 ;
            while(x*x<=b){
                printf(" ");
                x++;
            }
            x = 1 ;
            printf("\n");
            l++;
            n--;
    }
    return 0 ;
}