Am I doing these correctly?
Ok, so I have no programming experience and I started using "Let Us C" by Yashavant Kanetkar to teach myself C a few days ago. Unfortunately, I don't have the solutions to the exercises in the book, so I was wondering if I could get a little help from y'all. Here's the exercise, with each statement followed by my answer:
Point out the errors, if any, in the following C statements:
1.
Code:
int = 314.562 * 150;
no error
2.
both quotes should point to the left (i can't show this on my computer, but one quote is pointing one way and the other is pointing the opposite way)
3.
both quotes should point to the left (i can't show this on my computer, but one quote is pointing one way and the other is pointing the opposite way)
4.
Code:
3.14 * r * r * h = vol_of_cyl;
variable should be on the left, constant on the right
5.
Code:
k = (a * b)(c + (2.5a + b)(d + e);
* must be used for multiplication
6.
Code:
m_inst = rate of interest * amount in rs;
variable names can't have spaces in them
7.
Code:
si = principal * rateofinterest * numberofyears/100;
no errors
8.
Code:
area = 3.14 * r**2;
should be re2, not r**2
9.
Code:
volume = 3.14 * r^2 * h;
should be re2, not r^2
10.
Code:
k = ((a * b)+c)(2.5 * a + b);
must use * for multiplication. can't have parenthesis within parenthesis
11.
3 and 4 aren't the same? that's about all i can come up with.
12.
count isn't defined
13.
variables can't have spaces in them
Ok, as you can see, I'm pretty sorely in need of help. I really appreciate any assistance.