Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A+b+c+d=a*b*c*d=7.11 Write a program that will solve for a b c and d given the c

ID: 3648849 • Letter: A

Question

A+b+c+d=a*b*c*d=7.11 Write a program that will solve for a b c and d given the criteria above.

Explanation / Answer

The problem is to find a quadruple (a,b,c,d) of numbers such that: 1. a+b+c+d=7.11, 2. abcd=7.11. So, if we take K=100a, L=100b, M=100c, N=100d, then conditions 1. and 2. take the following form: 1. K+L+M+N = 100a+100b+100c+100d = 100(a+b+c+d) = 711, 2. KLMN = 711 000 000, and additionally 3. K, L, M, N are natural numbers. I managed to get the correct algorithm for the above mentioned problem, but since i am not good at C, i am not able to get it to work, the algorithm is as follows, 1. Choose the next natural number K > 0; if K > 711/4, stop. 2. If K divides 711 000 000, go to 3, otherwise go to 1. 3. Choose the next natural number L greater than or equal to K; if L > (711-K)/3, go to 1. 4. If L divides 711 000 000/K, go to 5, otherwise go to 3. 5. Choose the next natural number M greater than or equal to L; if M > (711-K-L)/2, go to 3. 6. If M divides 711 000 000/(KL), go to 7, otherwise go to 5. 7. If 711 000 000/(KLM) = 711-K-L-M,$ then the quadruple (K,L,M,N) with N=711-K-L-M is a solution. 8. Go to 5. #include #include main() { float K, L, M, N; start:; while(K>0) { if(K>711/4) break; } loc2:; if(711000000%K==0) goto loc3; else goto start; loc3:; while(L>=K) { if(L>(711-K)/3) goto start; } loc4:; if((711000000/K)%L==0) goto loc5; else goto loc3; loc5:; while(M>=L) { if(M>(711-K-L)/2) goto loc3; } loc6:; if((711000000/(K*L))%M==0) goto loc7; else goto loc5; loc7:; if((711000000/(K*L*M))==711-K-L-M) N=711-K-L-M; printf("%f", K); printf("%f", L); printf("%f", M); printf("%f", N); loc8:; goto loc5; end:; return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote