Question

     double ans = 10.0+2.0/3.0−2.0∗2.0; Try to write the C program to find the answer for...

     double ans = 10.0+2.0/3.0−2.0∗2.0; Try to write the C program to find the answer for the statement.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code :

#include <stdio.h>

int main()
{
    double ans = 10.0 + 2.0 / 3.0 - 2.0 * 2.0;
    printf("ans = %f",ans);

    return 0;
}

Explaination : Order of precedence

* / % Multiplication/division/modulus left-to-right
+ - Addition/subtraction left-to-right

Step 1 : 10.0 + 0.66667 - 2.0 * 2.0

Step 2 : 10.0 + 0.66667 - 4.0

Step 3 : 10.66667 - 4.0

Step 4 : 6.66667

Result :

Add a comment
Know the answer?
Add Answer to:
     double ans = 10.0+2.0/3.0−2.0∗2.0; Try to write the C program to find the answer for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A hard c++ problem ◎Write a c++ program”Student.h”include Private data member, string firstName; string lastName; double...

    A hard c++ problem ◎Write a c++ program”Student.h”include Private data member, string firstName; string lastName; double GPA(=(4.0*NumberOfAs+3.0*NumberOfBs+2.0*NumberOfCs+1.0*NumberOfDs)/( As+Bs+Cs+Ds+Fs)); Public data member, void setFirstName(string name); string getFirstName() const; void printFirstName() const; void getLastName(string name); string getLastName() const; void printLastName() const; void computeGPA(int NumberOfAs,int NumberOfBs,int NumberOfCs,int NumberOfDs,int NumberOfFs); double getGPA() const; double printGPA() const; A destructor and an explicit default constructor initializing GPA=0.0 and checking if GPA>=0.0 by try{}catch{}. Add member function, bool operator<(const Student); The comparison in this function based on...

  • х у V 1.0 7.6 1.0 1.0 2.0 8.7 11 2.0 2.0 3.0 7.3 3.0 3.0...

    х у V 1.0 7.6 1.0 1.0 2.0 8.7 11 2.0 2.0 3.0 7.3 3.0 3.0 4.0 5.8 11 10- 9- 8 7-1 6 5- 4+ 3+ 2 4.0 4.0 11 10 9+ 8+ 71 6+ 5+ 4+ 3+ 2+ 1. X 5.0 8.2 5.0 5.0 6.0 4.9 6.0 6.0 X 7.0 4.5 7.0 7.0 8.0 7.2. 8.0 8.0 0 1 2 3 4 5 6 7 8 9 10 11 7 8 9 10 11 9.0 5.9 9.0 9.0...

  • Glutamic acid (pK1 = 2.0, pK2 = 4.0, pK3 = 10.0) is dissolved in water. The...

    Glutamic acid (pK1 = 2.0, pK2 = 4.0, pK3 = 10.0) is dissolved in water. The isoelectric point (pI) of glutamic acid is A. 2.0 B. 3.0 C. 4.0 D. 7.0 E. 10.0

  • A17. A 2.0-cm diameter cylinder contains 50 ml. of water at 10.0 °C. What is the...

    A17. A 2.0-cm diameter cylinder contains 50 ml. of water at 10.0 °C. What is the change in the water level when the temperature rises to 80 °C? Ignore the change in the volume of the tube. |Buater 2.1x10+ PC, and 1 mL-1 cm3] (Ans: 0.23 cm)

  • The following table contains on the Richter scale and their descriptors: Magnitude Descriptor Less than 2.0...

    The following table contains on the Richter scale and their descriptors: Magnitude Descriptor Less than 2.0 Micro 2.0 to less than 3.0 Very minor 3.0 to less than 4.0 Minor 4.0 to less than 5.0 Light 5.0 to less than 6.0 Moderate 6.0 to less than 7.0 Strong 7.0 to less than 8.0 Major 8.0 to less than 10.0 Great 10.0 or more Meteoric Write a C program that reads a magnitude from the user and displays the appropriate descriptor...

  • It wants the final answer formatted as (ans) i - (ans) j ? 10 7 C...

    It wants the final answer formatted as (ans) i - (ans) j ? 10 7 C 10-7 C are placed at the corners of the triangle shown below. What is the force on q. (i The charges q,-3.8 × 10-7 C q2-5.5 and q3 1.9 5.0m 3.0 m 4.0 m 93 42

  • Three point charges, Q1 =-1.04C, Q2 = - 2.0 C, and Q3 = +3.0 C are...

    Three point charges, Q1 =-1.04C, Q2 = - 2.0 C, and Q3 = +3.0 C are placed as shown in the figure below. (k =1/480 = 8.99 x 10ºN.mp/C) Q 0.500 m Q 0.250 m 0.500 m Part A Find the x component of the electric field in N/C at the origin. EVO AEO ? Submit Request Answer Part B Find the y component of the electric field in N/C at the origin. IVO ALO ? Submit Request Answer

  • Write a C program to create the double arrays A and B, using the gen rand...

    Write a C program to create the double arrays A and B, using the gen rand mat function.

  • Please answer the question in blue. 1, = c 12 = -3.0 A = -24.0 V...

    Please answer the question in blue. 1, = c 12 = -3.0 A = -24.0 V + (6.0 12.11 (4.0.2)(-3.0 A) = 0 14.0 V -24.0 V + (6.0 12/1 + 12.0 12 = 0 11 = 2.0 A 4.0 12 13 = 11 + 12 13 = 2.0 A – 3.0 A = (-1.0 A 6.0 Ω 10.0 V Finalize: Because our values for 12 and 13 are negative, the directions of these currents are opposite those indicated in...

  • A 3.0 C charge is at the origin, a –6.0 C charge is at the coordinate...

    A 3.0 C charge is at the origin, a –6.0 C charge is at the coordinate (0.0, 0.25 m) and a 10.0 C charge is located at (2.0 m, 0.0 m). Calculate the potential at the position (2.0 m, 0.25 m). Draw a picture.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT