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

Decision 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

Decision Control Structure Part 3

Chap 2 : Unit 1 : Introduction to Decision Control Structure : Part 3

पण मुलांनॊ… आता हेच बघांना… प्रोग्रॅमिंग च्या जगामध्ये प्रोग्रॅममधील प्रत्येक स्टेटमेंट एग्झिक्युट होइल… असे प्रोग्रॅम्स असतील का हो? 

जसे रील laughलाइफ आणी रिअल लाईफ  मध्ये फरक असतोच ना?

म्हणजे आता… आपले लाईफ च बघा ना…सकाळ पासुन रात्री पर्यंत कीती वेगवेगळ्या घटनानी दिवस भरलेला असतॊ….! 

All programs in first introductory chapter of C language were having simple statements and all statements were getting executed. However like life program also becomes complex. So like various events in our life do not take place as we wish and are depended on many external factors, in programming too we need to consider this external factors to deal with situations

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

cenglishcppengcmarathi

Chap 2 : Unit 1 : Introduction to Decision Control Structure : Part 2

There are basically 4 types of instructions in any C program. I have explained it in deail in the first chapter. Let’s have a review…

  • Type declaration
  • Input and output statements
  • Arithmetic Instructions
  • Control Structures

Here Control Structures are also of 4 types viz.

  • Sequential Control Structures 
  • Decision Control Structure 
  • Loop Control Structure
  • Switch Case Control Structure

In the first chapter all programs were simple and each statement of program was getting executed. So it is called as sequential control structure.  yes

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

Chap. 1 : Unit 5 : Structure of C Language : Part 4

गेल्या १०-१२ वर्षाच्या शैक्षणिक कारकीर्दीमध्ये जितके ऑपरेटर पाहीले नसतील किंवा ऐकले नसतील त्यापेक्षा जास्त ऑपरेटरचे नमूने (माणसांप्रमाणेच) तुम्हाला या C programming language बघायला मिळतील/भेटतील/सापडतील किंवा आडवे येतीलlaugh. त्यांना वेगवेगळे अर्थ द्यायच डेनीस रिची च कौशल्य सुद्धा दिसेल… “मोठ्ठा माणूस” angel

We will study Ternary operator in the next chapter. Besides… in C, other than unary minus, ++, –, & are some of the examples of unary operators…. In mathematics, one can write expression like 3x + 4y equal to z…. but in C, its invalid statement. As per the rules stated by Dennis Ritchie, there should be variable on the left hand side and more importantly nothing is implicit while writing expression i.e. in mathematics 3x means 3 into x  but in C it gives an error and should be written as 3 into x! So above expression must be written as 3 into x plus 4 into y assigned to z in C I would like to reiterate one more important rule that, in C…. value of the expression on the right hand side or constant on the right hand side is assigned to variable on the left hand side. So though x is equal to x plus 3 is invalid statement in mathematics, it is valid in C. the reason is that here, 3 is first added to current value in the variable x and then the new value of expression is stored in… x itself. So if x contains 5 and expression is written as x is equal to x + 1 then 1 will be added to 5 and the new value i.e. 6 will be stored in x…. Hierarchy of Operators While solving an algebraic expression in school, you might have studied operator precedence rule. For example while solving the expression x is equal to 4 plus 5 into 7 divided by 9 minus 3 into bracket, you first solve the expression inside bracket then multiplication and division and addition in the last and then store the result in x…isn’t it? In C this is called as operator hierarchy. The chart of operator hierarchy is given here as in the standard book. Further we will solve a few small programs as well in the end of the chapter. Besides hierarchy, associativity also comes into picture when adjacent operators are having same precedence. For example in the above example multiplication and division operator have got same precedence. In such situation, expression needs to be solved from left to right. For few operators category like that of assignment operators, associativity is from right to left.

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

Chap. 1 : Unit 4 : Introduction to C Language: Part 5

इंटीजर कॉंन्स्टंट बघितला. शाळेमध्ये असतांना त्याला आपण पुर्णांक म्हणायचो. enlightenedआता पुर्ण आहे म्हणजे अनेक काही अपुर्णही असतं आयुश्यातwink. मग प्रोग्रॅमिंग लॅंग्वेज कशी काय अपवाद असू शकते? त्यामध्ये सुद्धा मग डेनीसनी नवीन डेटा टाइपची रचना केली. त्याला फ्लोटींग पॉइंट कॉंस्टंट म्हणतात. बॅंक लोन चा व्याज दर फ्लोटींग असतांना अनिश्चीत असतोfrown तशीच यामधील व्हॅल्यू सुद्धा असते..त्यामूळे जरा जपूनच वागायला लागते याच्याशी.broken heart म्हणून याचे नियम माहीत असणे जास्त महत्वाचे…angry

Real constant

If we want to store real constant then we need to create a real data. It is the one which contain decimal in it. So generally we can say like

It can be a positive or negative. For example 7.98 and -34.0985 are real constants

Default sign is positive. For example 5.6 is positive

Usually it contains decimal point

It must be a digit

Real constant cannot have blank space. For example 4.5 is valid but 56 78 89.90 is invalid

It cannot contain any special character. For example 4,785 .89 is invalid number

Under DOS environment it takes 4 bytes of memory

The keyword float is reserved for real constant

It is also called as floating point constant

Real number can be written in two ways.

Decimal format

Here it contains the decimal point. If number is small, usually it is written using this format

Exponential format

If number is too large or too small then this format is used

For example in mathematics if you can recall 540 billion can be written like 5.42 x 109. In C using exponential format it can be written like 5.42e9

By default any real number has got precision up to 6 decimal places

Access this framework with lot more stuff like C language MCQ, viva and interview preparation, Glossary, Solved Programs of C language etc. please register free on Register / Login

cenglishcppengcmarathi

Introduction to Computers Part 2

Chap. 1 : Unit 1: Introduction to Computers: Part 2

Even though…. you are well aware about computer fundamentals, this would act as a refresher module to understand further topics.

You might be aware that before we start learning language we need to know that computer system is comprised of hardware and software….

Hardware generally comprises of monitor…..keyboard….mouse…..CPU etc….whereas software is a set of programs….

Software again is broadly classified into two types……

One is System Software which is used for running a system….for example Operating system and other softwares.

The other type of software…..is application software….which is typically used by end user for day-to-day tasks…..

What you see…. on the left side of the frame on the monitor is hardware and that of on the right hand side are software….both these hardware and software are handled by primary software called Operating system….

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