Ternary Operator : Sample Program Part 2

Ternary Operator

The video explains the method to use ternary operator in C program. What is important here is, programmer should not forget that conditional expression written using ternary operator returns the value.

Ternary operator is very handy operator to make the code consice in many situation not only in C but C++ and Java as well.

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. please register for discount coupon

cenglishcppengcmarathi

Nested if else 01

Introduction to nesting of if else control structure

एका पेक्षा जास्त conditions check करायच्या असतील तर एका if किंवा if else कंट्रोल स्ट्रक्चर च्या बॉडीमध्ये दुसरे if किंवा if else control structure लिहावे लागते. अशा प्रकारच्या पद्धतीला nesting असे म्हणतात. नेस्टींग हे अन्य कंट्रोल स्ट्रक्चर मध्ये सुद्धा असते. या ठिकाणी नेस्टिंग म्हणजे काय, कोणत्या ठिकाणी वापरायचे, कसे वापरायचे हे सर्व सांगीतले आहे.

There are many ways to write if or if else blocks inside if or else blocks. So infinite combinations will take place as per need and situation of the problem. Ultimately it is the logic put by programmer to design the code.

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc.

cenglishcppengcmarathi

if else par 1

if else control structure Part 1 of 5

if else control structure is second control structure in the C language to take decision. Unlike if control strucure, this exclusively tells what is to be executed if condition becomes true or false.

Here if statement is followed by condition and if block and then else block is written. Like in the if control structure, here also we dont need to put the braces for if and/or else if only single statement is asscocited with if/else. Like if, else is also a keyword in C

cenglishcppengcmarathi

Decision Control Structure Part 2

Chap 2 : Unit 2 : If Control Structure : Part 2

“निर्णय चुकीचा असला तरी चालेल पण निर्णय घेण्याची क्षमता हवी कारण निर्णय बरोबर की चुकीचा हे येणारा काळ ठरवतो” किती सुंदर वाक्य आहे नाही हे…?

सी प्रोग्रॅमिंग लॅंग्वेजमध्ये Decision घेतांना If control structure कसे वापरायचे हेच तर आम्ही या ठिकाणी समजावून सांगीतलय

We will see how to write condition and how the if block needs to be written to get the associated statements be executed if condition becomes true.

When multiple statements are to be associated with if condition, we need to enclose all statements inside pair of curly braces following the if condition

Prima facie structure of if..condition seems to be very easy, but it is very difficult to find the situation while solving programs and that insight a programmer will get only after writing many programs. 

Identifying this situation is major challenge I would say for fresher.

Many times in day to day life we do not explicitly say what would happen or what would you do if certain condition is not satisfied…

For example if you tell your friend in Pune that you both would go to movie if he travels to Pune on weekends. However you need not mention what you would do in your home town if you cancel your plan to go to Pune on weekends. Act of watching movie will take place only when you go to Pune that’s all…

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. Register for Discount Coupon

 

cenglishcppengcmarathi

if control structure part 1

Chap 2 : Unit 2 : If Control Structure : part 1

Decision in programming is inherent of any language like in our life. The same is explained here and syntax of if control structure is here for you…

First is the if control structure. In C Language if is the  keyword enlightened 

Condition needs to be written in a pair of round brackets following the keyword if

This if condition is then followed by pair of curly braces…

All statements you write inside pair of curly braces are associated with if condition and it is called if block.enlightened

Now let’s see how condition is tested…

In C Language… condition can be tested using Relation operators provided by Dennis Ritchie

Can you recall how many operators we used in the last chapter….? Plus…(+) Minus (-)…Multiplication (*)…Division (/) …आणि Modulus… (%)..

All these were Mathematical operators 

and we used Assignment operator as well….

unknowingly what you used special charcaters like comma, semi colon were also operators…

Now in this chapter we will see six more operators.

These are <, >, <=, >=, ==, != all these operators are called as Relation operators to establish relation between operands….   

in C Language when we write condition using Relation operator we check whether conditional expresion is true or false

if it is True, Expression returns 1 or on the contrary if expression returns non zero value the condition becomes true.

likewise if expression false then value of the expression is zero and same is returned where as if value of the expressoin is zero then expression is false.

Where ever you use conditional expressions, don’t forget this important concept

And do remember that you will not put semi colon at the end of semi colon…. nonetheless a few exceptions are there too…!smiley

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. Register for Discount Coupon

cenglishcppengcmarathi