懂C語言的請幫忙…

2008-10-28 5:14 am
All values (x, y, p, s, total) are double:
1 read x

2 read y

3 compute p = x * y

4 compute s = x + y

5 total = s2 + p * (s - x) * (p + y)

6 print total

回答 (1)

2008-10-28 5:00 pm
✔ 最佳答案
/*
http://hk.knowledge.yahoo.com/question/question?qid=7008102701998
All values (x, y, p, s, total) are double:
1 read x
2 read y
3 compute p = x * y
4 compute s = x + y
5 total = s2 + p * (s - x) * (p + y)
6 print total
*/
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
double x,y,p,s,total;
printf("Input x:"); scanf("%lf",&x);
printf("Input y:"); scanf("%lf",&y);
p=x*y;
printf("p=x*y=%lf\n",p);
s=x+y;
printf("s=x+y=%lf\n",s);
total=s*s+p*(s-x)*(p+y);
printf("total=s*s+p*(s-x)*(p+y)=%lf\n",total);
}


收錄日期: 2021-04-13 16:11:53
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20081027000051KK01998

檢視 Wayback Machine 備份