Given the following pseudocode, write a program thatexecutes it. Use floating-point types for all values. Algorithm 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 End Given the following pseudocode, write a program thatexecutes it. Use floating-point types for all values. Algorithm 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 End
Explanation / Answer
please rate - thanks are you sure p and s are both supposed to be equal to x+y? #include #include int main() {float x,y,p,s,total; printf("Enter a value for x "); scanf("%f",&x); printf("Enter a value for y "); scanf("%f",&y); p=x+y; s=x+y; total=s*s+p*(s-x)*(p+y); printf("The value of total is %f ",total); getch(); return 0; }