Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter two Lesson Eleven: Expressions © www.waxkabaro.com.

Similar presentations


Presentation on theme: "Chapter two Lesson Eleven: Expressions © www.waxkabaro.com."— Presentation transcript:

1 Chapter two Lesson Eleven: Expressions © www.waxkabaro.com

2 Expressions –Definition Much of the program’s work is the calculation of expressions. Expressions are sequences of operators, literals and variables that are calculated to a value of some type (number, string, object or other type). © www.waxkabaro.com

3 Example  {  double r = 9;  // Expression for calculating the area of the circle  double area = Math.PI * r*r;  // Expression for calculating the perimeter of the circle  double perimeter = 2 * Math.PI * r;  Console.WriteLine(r);  Console.WriteLine(area);  Console.WriteLine(perimeter);  Console.ReadLine();  } © www.waxkabaro.com

4 Using Packets Using Brackets to Make the Code Clear When working with expressions it is important to use brackets whenever there is the slightest doubt about the priorities of the operations. © www.waxkabaro.com

5 Correct form vs incorrect form example { double qalad = (double)((1 + 2) / 4); Console.WriteLine(qalad); // 0 double sax = (double)(1 + 2) / 4; Console.WriteLine(sax); Console.WriteLine("2 + 3 = " + 2 + 3); // 2 + 3 = 23 Console.WriteLine("2 + 3 = " + (2 + 3)); // 2 + 3 = 5 Console.ReadLine(); } © www.waxkabaro.com

6 exercise Qor program ka shaqeynayo: 1) a)perimeter of Triangle p = s1+s2+s3 b) Area of Triangle- formula :Area=1/2(base*hight) 2) Volume of a Cube. Formula: Volume = side1*side2*side3 3) Volume of a cylinder. Formula: volume = Ωr 2 h(r= radios, h=hight) © www.waxkabaro.com


Download ppt "Chapter two Lesson Eleven: Expressions © www.waxkabaro.com."

Similar presentations


Ads by Google