Question: C# expressions 2. Convert the three formula below to C# expressions. Use the following four lines of code below to compute and display the result:
2. Convert the three formula below to C# expressions. Use the following four lines of code below to compute and display the result: double x1, volume; double a 1.0, b=2.83, C=1.2; double r=1.0; double theta=0.523599; -b + b2 - 4ac 1) x1 = 2a 2) volume 3) c = sin?(theta) + cos?(theta) - 3. Write a program that takes as input a four-digit number in format abcd (e.g. 1234) and performs the following actions: Calculates the sum of the digits (in our example 1+2+3+4 = 10). - Prints on the console the number in reversed order e.g. 4321). - Puts the last digit in the first position in our example 4123). Exchanges the second and the third digits (in our example 1324). Hints: To get the individual digits of a four-digit number (num) you can use the following expressions: num % 10; (num/10) % 10: (num/ 100) % 10 (num/ 1000) % 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
