[Android General] mhrsolanki2020:
Chapter 4​

Operators​

===================================================================

Hope the above image , clears your mind about what is variable and constants.. If you still have any confusion about variables and constants then mail me at helpline mail : c.helpline2020@gmail.com or PM me..

I devote this chapter to Operators..

Operators: The symbols used to make the computer do an operation is know as an operator .

There are various various types of operators:

1)Arithmetical Operators

2)Conditional Operators

3)Relational Operators

1)Arithmetical Operators :

-> Operators used for doing mathematical operations is know as arithmetical operators. This includes the following :

=

+

-

*

/

%

you may be familiar with all the mathematical expressions above, rather than this, one %.

This is not a percentage , its a modulor division operator. Its name is Modulus.

The division operator yields the Quotient as an answer, where as Modulus yields the Remainder as an Answer.

as you can see above,

when you write an expression as 13/2 it will yield an ans 6 . Therefore, 13/2 is 6 or may be 6.5 (calculation in flowchart is not so precise as it is just to understand the flow of the program and not for calculations)

when you write an expression as 13%2 it will yield an ans 1. Therefore, 13%2 is 1.

====================

2)Conditional Operators

Operators that define conditions are known as conditional operators.

They include these

|

&

This | is "OR" operator. It is used when you want to define any conditions like : a<10|a>15. This means either a is less than 10 OR it is greater than 15 , then its yes . (refering to the decision box, cuz thats the only place where you want to put up conditions right?) Only one of the two conditions must be satisfied , in order to make it a YES

If not even one condition is satisfied then it is a NO , n it will run different set of codes .

Image below will help you understand it.

==============================

The second operator is & "AND" operator. This is used when you want conditions like : a>100&a<200. in this , a should be greater than 100 AND a should also be less than 200 , if both the conditions satisfy then only it is a yes, if either of the condition is not satisfied, then its a no.

=======================================================================

3)Relational operators:

->Operators used for relating two variables are known as Relational Operators

They are as follows:

==

<

>

<=

>=

!=

Note: '=' is used to assign the value, eg , a=4, this means a is equal to 4, where as , a==4 , is a relational operator, it checks , IS a is equal to 4?

The two operators == and != are new to you, i explained the first one above,

the second one != is "not equal to", it is used to check , eg , Is a!=4?,if a is not equal to 4 thn its a yes, if a is equal to 4 then its a no.

========================================================================

A flow chart to check whether the number input by the user is positive or negative?

Try this on your own , n then see the answer below,

You would notice , there is a circle after the processing box..

It is an on page conector. When more than one flow lines are conected to something , then this is used, (i havent used it in any of the above eg of flowcharts, just to teach you bit by bit.)

This is what i used before:

this is what is to be used :

====================================================================

This was it Small Chapter 4. On operators..

If you have done this much ,then be proud of your self, cuz u have learned half of the basics of C programming :D :D :D

Next chapter it about Subroutine and off page conector. And then we will commence out voyage in C programming ;)