请哪位高手帮编个计算表面积的程序

1个回答

  • #include "stdio.h"

    main()

    {

    float a,b,c,p,sum,sa;

    char t='y';

    sa=0;

    while(t=='y')

    {printf("please inputn");

    printf("a=");scanf("%f",&a);

    printf("b=");scanf("%f",&b);

    printf("c=");scanf("%f",&c); ;

    printf("this superficial area=%fn",2*(a*b+a*c+b*c));

    printf("n");

    fflush(stdin);

    printf("hit'Y'input again(or 'N' end):");

    scanf("%c",&t);

    sa=sa+2*(a*b+a*c+b*c);

    }

    printf("n");

    printf("the totle superficial area=%fn",sa);

    fflush(stdin);

    printf("price=");scanf("%f",&p);

    sum=sa*p;

    printf("the totle sum=%fn",sum);

    system("pause");

    }